statacompat: Reproduce Selected 'Stata' Expression and Missing-Value Semantics

A lightweight compatibility layer for researchers translating 'Stata' data-management code into R. Provides vectorised helpers that reproduce selected 'Stata' expression semantics where they differ from base R, most importantly "Stata's" rule that numeric missing values are larger than every number: relational comparisons, inlist(), inrange(), cond(), missing(), and the 'egen' row functions rowtotal(), rowmean(), rowmiss() and rownonmiss(). Only the ordinary missing value is fully supported; "Stata's" extended missing values are detected and rejected wherever they would change a result.

Version: 1.0
Depends: R (≥ 4.1.0)
Suggests: dplyr, haven, knitr, rmarkdown, testthat (≥ 3.0.0), withr
Published: 2026-11-18
DOI: 10.32614/CRAN.package.statacompat (may not be active yet)
Author: Ari Purwanto Sarwo Prasojo ORCID iD [aut, cre]
Maintainer: Ari Purwanto Sarwo Prasojo <ari.prasojo18 at gmail.com>
BugReports: https://github.com/aripurwantosp/statacompat/issues
License: MIT + file LICENSE
URL: https://github.com/aripurwantosp/statacompat
NeedsCompilation: no
Materials: README, NEWS
CRAN checks: statacompat results

Documentation:

Reference manual: statacompat.html , statacompat.pdf
Vignettes: When Stata and R Disagree: Expressions and Missing Values (source, R code)

Downloads:

Package source: statacompat_1.0.tar.gz
Windows binaries: r-devel: statacompat_1.0.zip, r-release: not available, r-oldrel: not available
macOS binaries: r-release (arm64): statacompat_1.0.tgz, r-oldrel (arm64): statacompat_1.0.tgz, r-release (x86_64): statacompat_1.0.tgz, r-oldrel (x86_64): statacompat_1.0.tgz

Linking:

Please use the canonical form https://CRAN.R-project.org/package=statacompat to link to this page.