R index
Descriptions include functions without a paired example. A linked Stata name leads to the command index; this is a reference, not an installation list.
AER
ivreg()— Instrumental-Variable Regression Stata:ivregress. ↗tobit()— Tobit (censored) regression
base
.libPaths()— Search Paths for Packages Stata:adopath. ↗abs()— Absolute value Stata:abs(). ↗all()— Whether all values are TRUE Stata:assert. ↗any()— Whether any value is TRUE Stata:count if. ↗anyDuplicated()— Determine Duplicate Elements Stata:gisid. ↗anyNA()— Not Available / Missing Values Stata:gisid. ↗apply()— Apply a function over rows or columns Stata:egen rowtotal(). ↗as.character()— Convert to textas.data.frame()— Coerce to a Data Frame Stata:getmata. ↗as.Date()— Convert to a dateas.double()— Convert to double-precision numbersas.factor()— Convert to a factor Stata:encode. ↗as.integer()— Convert to whole numbersas.matrix()— Matrices Stata:cf. ↗as.numeric()— Convert to numbersas.POSIXct()— Date-time Conversion Functions Stata:clock. ↗as.vector()— Vectors - Creation, Coercion, etc Stata:margins. ↗attr()— Get or set an attribute of an objectattributes()— Object Attribute Lists Stata:char. ↗body()— Access to and Manipulation of the Body of a Function Stata:viewsource. ↗c()— Combine values into a vectorcat()— Print text without quotescbind()— Put side by side (base R) Stata:merge 1:1 _n. ↗ceiling()— Round upcharacter()— Character Vectors Stata:tokenize. ↗charToRaw()— Convert to or from (Bit/Packed) Raw Vectors Stata:changeeol. ↗chol()— The Cholesky Decomposition Stata:irf. ↗class()— Class of an object Stata:describe. ↗close()— Functions to Manipulate Connections (Files, URLs, …) Stata:file. ↗col()— Column Indexes Stata:spmatrix. ↗colMeans()— Form Row and Column Sums and Means Stata:margins. ↗colnames()— Column names Stata:ds. ↗colSums()— Form Row and Column Sums and Means Stata:missings. ↗crossprod()— Matrix Cross-Product Stata:tsfilter. ↗cumprod()— Running product Stata:generate. ↗cumsum()— Running sumcut()— Cut numbers into intervalsdata.frame()— Data Frames Stata:range. ↗diag()— Diagonal of a matrixdiff()— Differences between neighbouring values Stata:D.. ↗dim()— Numbers of rows and columns Stata:describe. ↗dir()— List files in a folderdir.create()— Create a folder Stata:mkdir. ↗do.call()— Call a function with a list of arguments Stata:program. ↗double()— Double-Precision Vectors Stata:postfile. ↗dput()— Write an Object to a File or Recreate it Stata:dataex. ↗drop()— Drop Redundant Extent Information Stata:lincom. ↗droplevels()— Drop unused factor levels Stata:label define. ↗duplicated()— Determine Duplicate Elements Stata:gegen. ↗eigen()— Spectral Decomposition of a Matrix Stata:varstable. ↗environment()— Environment Access Stata:include. ↗exp()— Exponential Stata:exp(). ↗expand.grid()— Create a Data Frame from All Combinations of Factor Variables Stata:arimasoc. ↗factor()— Categorical variable with labelled levelsfile()— Functions to Manipulate Connections (Files, URLs, …) Stata:file. ↗file.copy()— File Manipulation Stata:copy. ↗file.exists()— Whether a file exists Stata:confirm file. ↗file.info()— Extract File Information Stata:hexdump. ↗file.path()— Build a file path Stata:global path. ↗floor()— Round downformat()— Format values for displayformatC()— Format numbers with width and padding Stata:string(x, "%9.2f"). ↗getwd()— Show the working directorygrep()— Pattern Matching and Replacement Stata:unab. ↗grepl()— Whether text matches a patterngsub()— Replace every match Stata:subinstr(). ↗I()— Inhibit Interpretation/Conversion of Objects Stata:regress. ↗iconv()— Convert Character Vector between Encodings Stata:unicode. ↗identical()— Test Objects for Exact Equality Stata:cf. ↗ifelse()— Vectorised if-else (base R) Stata:cond(). ↗integer()— Integer Vectors Stata:gdistinct. ↗interaction()— Combine factors into one Stata:egen group(). ↗invisible()— Change the Print Mode to Invisible Stata:exit. ↗is.character()— Whether a vector holds text Stata:confirm string variable. ↗is.infinite()— Finite, Infinite and NaN Numbers Stata:gencohort. ↗is.na()— Whether values are missingis.nan()— Finite, Infinite and NaN Numbers Stata:egen. ↗is.numeric()— Whether a vector holds numbers Stata:confirm numeric variable. ↗lapply()— Apply a function to each element, returning a list Stata:foreach. ↗length()— Number of elements Stata:count. ↗lengths()— Lengths of List or Vector Elements Stata:wordcount. ↗levels()— Categories of a factorlibrary()— Attach a package Stata:ssc install. ↗list()— A list of objectslist.files()— Files in a folder Stata:dir. ↗load()— Load objects from an .RData file Stata:use. ↗local()— Evaluate an (Unevaluated) Expression Stata:tempvar. ↗log()— Logarithm (natural by default)log10()— Base-10 logarithm Stata:log10(). ↗logical()— Logical Vectors Stata:missings. ↗ls()— List objects in memorymake.names()— Turn text into valid namesmapply()— Apply a Function to Multiple List or Vector Arguments Stata:arimasoc. ↗match()— Value Matching Stata:rename. ↗match.arg()— Argument Verification Using Partial Matching Stata:unabcmd. ↗matrix()— Create a matrixmax()— Largest valuemean()— Meanmerge()— Merge two data frames (base R) Stata:merge. ↗message()— Print a message Stata:display. ↗min()— Smallest valueMod()— Complex Numbers and Basic Functionality Stata:psdensity. ↗names()— Names of an object, such as column namesnchar()— Number of characters Stata:strlen(). ↗ncol()— Number of columns Stata:describe. ↗nlevels()— Number of factor levels Stata:levelsof. ↗normalizePath()— Express File Paths in Canonical Form Stata:findfile. ↗nrow()— Number of rowsnumeric()— Numeric Vectors Stata:rangestat. ↗options()— Set global options Stata:set. ↗order()— Positions that would sort a vector Stata:sort. ↗paste()— Join text with a separatorpaste0()— Join text without a separatorplot()— Basic plotpmatch()— Partial String Matching Stata:unab. ↗pmax()— Element-wise maximum of several vectors Stata:max(a, b). ↗pmin()— Element-wise minimum of several vectors Stata:min(a, b). ↗print()— Print an objectprop.table()— Turn counts into proportionsproportions()— Turn a table into proportions Stata:tabulate, row. ↗qr()— The QR Decomposition of a Matrix Stata:orthog. ↗qr.Q()— Reconstruct the Q, R, or X Matrices from a QR Object Stata:orthog. ↗R.home()— Return the R Home Directory Stata:sysdir. ↗range()— Minimum and maximum Stata:summarize. ↗rank()— Ranks, with ties averagedrbind()— Stack rows (base R) Stata:append. ↗readBin()— Transfer Binary Data To and From Connections Stata:hexdump. ↗readLines()— Read Text Lines from a Connection Stata:changeeol. ↗readRDS()— Read an R object file (.rds) Stata:use. ↗regexpr()— Pattern Matching and Replacement Stata:strpos. ↗rep()— Repeat values Stata:expand. ↗rep_len()— Repeat values to a given lengthreplace()— Replace Values in a Vector Stata:generate. ↗replicate()— Apply a Function over a List or Vector Stata:bootstrap. ↗requireNamespace()— Loading and Unloading Name Spaces Stata:ftools. ↗return()— Function Definition Stata:exit. ↗rev()— Reverse the order Stata:gsort. ↗rm()— Remove objects from memoryround()— Round to a number of decimalsrow()— Row Indexes Stata:spmatrix. ↗rowMeans()— Form Row and Column Sums and Means Stata:egen. ↗rowSums()— Sum across columns in each rowsample()— Random sample of values Stata:sample. ↗sample.int()— Random Samples and Permutations Stata:bsample. ↗sapply()— Apply a function to each element and simplify Stata:foreach. ↗save()— Save objects to an .RData file Stata:save. ↗saveRDS()— Save one R object to a filescale()— Standardise columns Stata:egen std(). ↗scan()— Read Data Values Stata:tokenize. ↗seq()— Sequence of numbersseq_along()— Positions of the elements of a vector Stata:_n. ↗seq_len()— Whole numbers from 1 to n Stata:_n. ↗serialize()— Simple Serialization Interface Stata:datasignature. ↗set.seed()— Make random numbers reproduciblesetwd()— Change the working directorysign()— Sign Function Stata:compare. ↗signif()— Round to significant digits Stata:round(). ↗sin()— Trigonometric Functions Stata:tsfilter. ↗sink()— Send console output to a filesolve()— Solve a System of Equations Stata:estat. ↗sort()— Sort a vectorsource()— Run an R scriptsplit()— Split data into groups Stata:by. ↗sprintf()— Format numbers and text with a templatesqrt()— Square rootstop()— Stop with an error Stata:exit 198. ↗stopifnot()— Stop if a condition is not TRUEstrsplit()— Split strings Stata:split. ↗sub()— Replace the first match Stata:regexr(). ↗subset()— Rows meeting a condition (base R) Stata:keep if. ↗substr()— Part of a string by position Stata:substr(). ↗sum()— Sumsummary()— Summary of an object, such as a modelSys.Date()— Today’s dateSys.sleep()— Suspend Execution for a Time Interval Stata:sleep. ↗sys.source()— Parse and Evaluate Expressions from a File Stata:include. ↗Sys.time()— Current date and time Stata:c(current_time). ↗t()— Transpose a matrixtable()— Count valuestapply()— Apply a function within groups Stata:bysort g: egen. ↗tempdir()— Create Names for Temporary Files Stata:sysdir. ↗tempfile()— Name for a temporary filetolower()— Lower case Stata:strlower(). ↗toupper()— Upper case Stata:strupper(). ↗traceback()— Show where the last error happenedtransform()— Transform an Object, for Example a Data Frame Stata:expandcl. ↗trimws()— Remove leading and trailing spaces Stata:strtrim(). ↗trunc()— Drop the decimals Stata:int(). ↗try()— Run code and continue after an error Stata:capture. ↗tryCatch()— Handle errors and warnings Stata:capture. ↗typeof()— Storage type Stata:describe. ↗unclass()— Object Classes Stata:rotate. ↗unique()— Distinct valuesunname()— Remove names or dimnames Stata:cf. ↗unsplit()— Divide into Groups and Reassemble Stata:permute. ↗vapply()— Apply a Function over a List or Vector Stata:gdistinct. ↗vector()— Vectors - Creation, Coercion, etc Stata:irf. ↗warning()— Give a warning Stata:display as error. ↗which()— Positions where a condition is TRUE Stata:list if. ↗with()— Evaluate code with the columns of a data framewriteBin()— Transfer Binary Data To and From Connections Stata:changeeol. ↗writeLines()— Write Lines to a Connection Stata:checksum. ↗xor()— Logical Operators Stata:egen. ↗
betareg
betareg()— Beta Regression for Rates and Proportions Stata:betareg. ↗
binsreg
binsreg()— Binned scatter plot and estimation
boot
broom
augment()— Add fitted values and residuals to the data Stata:predict. ↗glance()— One-row summary of model statisticstidy()— Coefficient table as a data frame
car
Anova()— Type II and III ANOVA tables Stata:anova. ↗avPlots()— Added-variable plotsdeltaMethod()— Estimate and Standard Error of a Nonlinear Function of Estimated Regression Coefficients Stata:nlcom. ↗leveneTest()— Levene’s Test Stata:robvar. ↗linearHypothesis()— Test linear restrictions on coefficients Stata:test. ↗vif()— Variance inflation factors
class
knn()— k-Nearest Neighbour Classification Stata:discrim. ↗
cobalt
bal.tab()— Display Balance Statistics in a Table Stata:pstest. ↗
coda
data.table
datawizard
winsorize()— Winsorise extreme values
DBI
dbAppendTable()— Insert rows into a table Stata:jdbc. ↗dbDisconnect()— Disconnect (close) a connection Stata:odbc. ↗dbGetQuery()— Retrieve results from a query Stata:odbc. ↗dbListFields()— List field names of a remote table Stata:odbc. ↗dbListTables()— List remote tables Stata:odbc. ↗dbReadTable()— Read database tables as data frames Stata:jdbc. ↗
did
att_gt()— Staggered difference in differences (Callaway-Sant’Anna)
dplyr
across()— Apply the same calculation to several columnsadd_count()— Add a column with group counts Stata:bysort g: generate n = _N. ↗all_of()— Select columns named in a character vector Stata:keep `vars'. ↗anti_join()— Keep rows of the first table with no match in the secondany_of()— Select listed columns that exist Stata:capture keep. ↗arrange()— Sort rowsbetween()— Whether values lie within a rangebind_cols()— Put tables side by sidebind_rows()— Stack tables on top of each otherc_across()— Combine columns inside rowwise() Stata:egen rowtotal(). ↗case_match()— Recode values by matching them Stata:recode. ↗case_when()— Several if-else conditions in one stepcoalesce()— First non-missing value across vectorsconsecutive_id()— Number runs of identical values Stata:tsspell. ↗contains()— Select columns whose names contain some textcount()— Count rows in each groupcross_join()— Every combination of rows from two tablescumall()— Running all(): TRUE until the first FALSE Stata:sum(). ↗cume_dist()— Cumulative distribution Stata:cumul. ↗cur_group()— Keys of the current group Stata:by. ↗cur_group_id()— Number of the current groupdense_rank()— Ranks without gaps Stata:egen group(). ↗desc()— Sort in descending order inside arrange()distinct()— Keep unique rowsends_with()— Select columns whose names end with some texteverything()— Select all columns Stata:_all. ↗filter()— Keep rows that meet a conditionfirst()— First value Stata:x[1]. ↗full_join()— Merge keeping all rows of both tablesglimpse()— Compact view of all columns Stata:describe. ↗group_by()— Group rows so later steps work within groupsgroup_split()— Split a table into one table per group Stata:by. ↗group_vars()— Names of the grouping variables Stata:by. ↗if_all()— Whether a condition holds in all of several columns Stata:egen rowmin(). ↗if_any()— Whether a condition holds in any of several columns Stata:egen anymatch(). ↗if_else()— One value if a condition holds, another if notinner_join()— Merge keeping only matched rowsintersect()— Rows in both tables Stata:merge, keep(match). ↗join_by()— Join keys, including inequality and range joins Stata:joinby. ↗lag()— Value from the previous rowlast()— Last value Stata:x[_N]. ↗last_col()— The last column Stata:order. ↗lead()— Value from the next rowleft_join()— Merge keeping all rows of the first tablematches()— Select columns whose names match a regular expressionmin_rank()— Ranks with ties given the lowest rank Stata:egen rank(), track. ↗mutate()— Create or change columnsn()— Number of rows in the current groupn_distinct()— Number of distinct values Stata:distinct. ↗na_if()— Turn one value into missingnear()— Compare numbers with a tolerance Stata:reldif(). ↗nth()— Value at a given position Stata:x[5]. ↗ntile()— Split into n groups of nearly equal size Stata:xtile. ↗num_range()— Select x1, x2 and so on by number Stata:keep x1-x5. ↗percent_rank()— Rank rescaled to 0-1 Stata:egen rank(). ↗pick()— Select columns inside mutate() or summarise() Stata:varlist. ↗pull()— Extract one column as a vectorreframe()— Summarise to any number of rows per group Stata:collapse. ↗relocate()— Move columns to a new positionrename()— Rename columns (new = old)rename_with()— Rename columns with a function, such as toupperright_join()— Merge keeping all rows of the second tablerow_number()— Row numberrows_update()— Update rows from another table Stata:merge, update replace. ↗rowwise()— Compute row by row Stata:egen rowmean(). ↗select()— Keep or drop columnssemi_join()— Keep rows of the first table that have a match in the secondsetdiff()— Rows in the first table only Stata:merge, keep(master). ↗slice()— Keep rows by positionslice_head()— First rows of each group Stata:bysort g: keep if _n <= 3. ↗slice_max()— Rows with the largest values Stata:gsort -x; keep in 1/5. ↗slice_min()— Rows with the smallest values Stata:sort x; keep in 1/5. ↗slice_sample()— Random sample of rowsslice_tail()— Last rows of each group Stata:bysort g: keep if _n > _N - 3. ↗starts_with()— Select columns whose names start with some textsummarise()— Reduce each group to one row of statisticssummarize()— Same as summarise() Stata:collapse. ↗tally()— Count rows Stata:count. ↗transmute()— Create columns and keep only those Stata:keep. ↗ungroup()— Remove groupingunion()— Rows in either table, without duplicates Stata:append. ↗where()— Select columns by type, such as where(is.numeric) Stata:ds, has(type numeric). ↗
effectsize
cohens_d()— Cohen’s d and Other Standardized Differences Stata:esize. ↗
estimatr
iv_robust()— Two-Stage Least Squares Instrumental Variables Regression Stata:ivregress. ↗
fixest
coefplot()— Coefficient plot for fixest models Stata:coefplot. ↗etable()— Regression table for fixest models Stata:esttab. ↗feglm()— GLM, such as logit, with fixed effects Stata:xtlogit. ↗fenegbin()— Negative binomial model with fixed effects Stata:xtnbreg. ↗feols()— Linear regression with fixed effects, clustering and IVfepois()— Poisson regression with fixed effectsfitstat()— Fit statistics, including the first-stage F Stata:estat firststage. ↗sunab()— Sun and Abraham interactions Stata:eventstudyinteract. ↗
flextable
flextable()— Formatted table for Word or PowerPointsave_as_docx()— Save tables to a Word file
forcats
fct_collapse()— Combine levels into groups Stata:recode. ↗fct_count()— Count each level Stata:tabulate. ↗fct_drop()— Drop unused levels Stata:label define. ↗fct_infreq()— Order levels by frequency Stata:tabulate x, sort. ↗fct_lump_n()— Lump rare levels into Other Stata:recode. ↗fct_na_value_to_level()— Make missing values a level Stata:tabulate x, missing. ↗fct_recode()— Rename factor levels Stata:label define, modify. ↗fct_relevel()— Move factor levels to the front Stata:ib3.x. ↗fct_reorder()— Order levels by another variable Stata:graph bar, sort. ↗fct_rev()— Reverse the order of levels Stata:label define. ↗
forecast
fracdiff
fracdiff()— ML Estimates for Fractionally-Differenced ARIMA (p,d,q) models Stata:arfima. ↗
fwildclusterboot
boottest()— Fast wild cluster bootstrap inference Stata:boottest. ↗
geepack
geeglm()— Fit Generalized Estimating Equations (GEE) Stata:xtgee. ↗
ggplot2
aes()— Map variables to x, y, colour and other plot featuresafter_stat()— Control aesthetic evaluation Stata:histogram. ↗annotate()— Add one annotation, such as text Stata:text(). ↗coord_cartesian()— Zoom in without dropping data Stata:xscale(range()). ↗coord_flip()— Swap the x and y axescoord_polar()— Polar coordinates, used for pie chartsfacet_grid()— Panels by two variables Stata:by(). ↗facet_wrap()— One panel per groupgeom_abline()— Line with a given slope and intercept Stata:function. ↗geom_area()— Area plotgeom_bar()— Bar chart of countsgeom_boxplot()— Box plotgeom_col()— Bars with given heights Stata:graph bar (asis). ↗geom_contour()— 2D contours of a 3D surface Stata:twoway. ↗geom_density()— Density curvegeom_errorbar()— Error bars or capped rangesgeom_histogram()— Histogramgeom_hline()— Horizontal reference line Stata:yline(). ↗geom_jitter()— Jittered points Stata:scatter, jitter(). ↗geom_label()— Text labels in boxes Stata:mlabel(). ↗geom_line()— Lines connecting observationsgeom_linerange()— Vertical intervals: lines, crossbars & errorbars Stata:twoway. ↗geom_point()— Points (scatter plot)geom_pointrange()— Points with intervals Stata:rcap. ↗geom_qq()— Quantile-quantile pointsgeom_qq_line()— Reference line for a quantile-quantile plotgeom_rect()— Rectangles Stata:twoway. ↗geom_ribbon()— Shaded band between two valuesgeom_segment()— Line segments and curves Stata:twoway. ↗geom_sf()— Map from spatial data Stata:spmap. ↗geom_smooth()— Fitted line or smooth curvegeom_step()— Step plot Stata:line, connect(stairstep). ↗geom_text()— Text labels on a plotgeom_tile()— Heat-map tiles Stata:heatplot. ↗geom_violin()— Violin plotgeom_vline()— Vertical reference lineggplot()— Start a plotggsave()— Save a plot to a filelabs()— Title and axis labels Stata:title(). ↗position_dodge()— Place bars or points side by side Stata:over(). ↗position_jitter()— Jitter points to avoid overplotting Stata:dotplot. ↗scale_colour_manual()— Choose colours by hand Stata:mcolor(). ↗scale_fill_brewer()— ColorBrewer fill colours Stata:set scheme. ↗scale_x_continuous()— Axis breaks and labels Stata:xlabel(). ↗scale_x_log10()— Logarithmic x axis Stata:xscale(log). ↗scale_y_continuous()— Position scales for continuous data (x & y) Stata:scatter. ↗scale_y_log10()— Position scales for continuous data (x & y) Stata:scatter. ↗stat_ecdf()— Empirical cumulative distribution plot Stata:cumul. ↗stat_summary()— Plot a summary, such as the mean, of y at each xstat_summary_2d()— Summarize a variable within two-dimensional bins Stata:heatplot. ↗theme()— Fine-tune the look of a plot Stata:graphregion(). ↗theme_bw()— Black-and-white plot themetheme_classic()— Classic plot theme Stata:set scheme. ↗theme_minimal()— Minimal plot theme Stata:set scheme. ↗theme_set()— Set the default theme for every plotxlim()— Limits of the x axis Stata:xscale(range()). ↗
glmmTMB
glmnet
cv.glmnet()— Cross-validation for glmnet Stata:lasso. ↗
GPArotation
graphics
pairs()— Scatter-plot matrixplot()— The Default Scatterplot Function Stata:quantile. ↗stem()— Stem-and-leaf display
grid
arrow()— Describe arrows to add to a line Stata:twoway. ↗
gtsummary
haven
as_factor()— Turn labelled values into a factor Stata:decode. ↗is_tagged_na()— “Tagged” missing values Stata:mvencode. ↗labelled()— Attach value labels to a vectorprint_labels()— Show value labels Stata:label list. ↗read_dta()— Read a Stata .dta fileread_sas()— Read a SAS fileread_sav()— Read an SPSS .sav fileread_xpt()— Read and write SAS transport files Stata:import. ↗tagged_na()— Stata-style extended missing values such as .a Stata:replace x = .a. ↗write_dta()— Write a Stata .dta filewrite_sav()— Write an SPSS file Stata:savespss. ↗write_xpt()— Read and write SAS transport files Stata:export. ↗zap_labels()— Remove value labelszap_missing()— Turn special missing values into NA Stata:mvdecode. ↗
janitor
adorn_totals()— Add totals to a tabyl Stata:tabulate x1 x2. ↗clean_names()— Clean and lower-case variable names Stata:rename *, lower. ↗get_dupes()— List duplicated rows Stata:duplicates list. ↗remove_empty()— Drop empty rows and columns Stata:missings dropvars. ↗tabyl()— Frequency and cross tables Stata:tabulate. ↗
labelled
look_for()— Find variables by name or label Stata:lookfor. ↗set_variable_labels()— Set variable labelsto_factor()— Turn labelled values into a factor Stata:decode. ↗val_labels()— Get or set value labels Stata:label values. ↗var_label()— Get or set a variable label Stata:label variable. ↗
lavaan
cfa()— Fit Confirmatory Factor Analysis Models Stata:sem. ↗fitMeasures()— Fit Measures for a Latent Variable Model Stata:estat. ↗lavResiduals()— Residuals Stata:estat. ↗modindices()— Modification Indices Stata:estat. ↗sem()— Structural equation modelstandardizedSolution()— Standardized Solution Stata:sem. ↗
lme4
fixef()— Extract fixed-effects estimates Stata:quadchk. ↗glmer()— Multilevel generalised linear modelglmerControl()— Control of Mixed Model Fitting Stata:melogit. ↗lmer()— Multilevel linear modelranef()— Predicted random effects Stata:predict, reffects. ↗VarCorr()— Variance components of a multilevel model Stata:estat sd. ↗
lmtest
bptest()— Breusch-Pagan test for heteroskedasticitycoeftest()— Coefficient tests with a chosen variance matrixgrangertest()— Test for Granger Causality Stata:vargranger. ↗lrtest()— Likelihood-ratio testresettest()— RESET test for omitted variableswaldtest()— Wald test of nested models Stata:test. ↗
lubridate
as_date()— Convert to a date Stata:dofc(). ↗day()— Day of the monthdays()— A period of days, for date arithmetic Stata:d + 7. ↗days_in_month()— Get the number of days in the month of a date-time Stata:daysinmonth. ↗dmy()— Parse day-month-year text into a date Stata:date(s, "DMY"). ↗floor_date()— Round a date down to a unit, such as the month Stata:mofd(). ↗hour()— Hour of a date-time Stata:hh(). ↗interval()— Time span between two datesmake_date()— Date from year, month and daymake_datetime()— Date-time from its parts Stata:mdyhms(). ↗mdy()— Parse month-day-year text into a date Stata:date(s, "MDY"). ↗minute()— Minute of a date-time Stata:mm(). ↗month()— Month of a datenow()— Current date and time Stata:now(). ↗quarter()— Quarter of a date Stata:quarter(). ↗time_length()— Length of a time span in chosen units, such as yearstoday()— Today’s date Stata:today(). ↗wday()— Day of the weekweek()— Week of the year Stata:week(). ↗yday()— Day of the year Stata:doy(). ↗year()— Year of a dateyears()— A period of years, for date arithmetic Stata:d + 365. ↗ymd()— Parse text such as 2024-01-31 into a dateymd_hms()— Parse text into a date-time
marginaleffects
avg_comparisons()— Average contrasts Stata:margins r.x. ↗avg_predictions()— Average predictions, like Stata’s marginsavg_slopes()— Average marginal effectscomparisons()— Differences between predictions (contrasts) Stata:margins r.x. ↗hypotheses()— Tests of linear and nonlinear hypothesesplot_predictions()— Plot predictions, like marginsplotplot_slopes()— Plot marginal effects Stata:marginsplot. ↗predictions()— Predictions with standard errors Stata:margins. ↗slopes()— Marginal effects for each observation Stata:margins, dydx(x) at(). ↗
MASS
boxcox()— Box-Cox Transformations for Linear Models Stata:boxcox. ↗corresp()— Simple Correspondence Analysis Stata:ca. ↗glm.nb()— Negative binomial regressionisoMDS()— Kruskal’s Non-metric Multidimensional Scaling Stata:mds. ↗lda()— Linear Discriminant Analysis Stata:discrim. ↗mca()— Multiple Correspondence Analysis Stata:mca. ↗mvrnorm()— Simulate from a Multivariate Normal Distribution Stata:drawnorm. ↗polr()— Ordered logit or probitqda()— Quadratic Discriminant Analysis Stata:discrim. ↗rlm()— Robust regression
MatchIt
match_data()— Construct a matched dataset from a matchit object Stata:psmatch2. ↗matchit()— Matching for causal inference
MCMCpack
MCMCregress()— Markov Chain Monte Carlo for Gaussian Linear Regression Stata:bayesmh. ↗
metafor
cumul()— Cumulative Meta-Analysis for ‘rma’ Objects Stata:meta. ↗escalc()— Calculate Effect Sizes and Outcome Measures Stata:meta. ↗leave1out()— Leave-One-Out Diagnostics for ‘rma’ Objects Stata:meta. ↗ranktest()— Rank Correlation Test for Funnel Plot Asymmetry Stata:meta. ↗regtest()— Regression Test for Funnel Plot Asymmetry Stata:meta. ↗rma()— Meta-Analysis via Linear (Mixed-Effects) Models Stata:meta. ↗trimfill()— Trim and Fill Analysis for ‘rma.uni’ Objects Stata:meta. ↗
mice
complete()— Extracts the completed data from a mids object Stata:mi. ↗D1()— Compare two nested models using D1-statistic Stata:mi. ↗D2()— Compare two nested models using D2-statistic Stata:mi. ↗make.predictorMatrix()— Creates a predictorMatrix argument Stata:mi. ↗mice()— Multiple imputation by chained equationspool()— Combine results across imputationspool.scalar()— Multiple imputation pooling: univariate version Stata:mi. ↗
mitools
MIcombine()— Multiple imputation inference Stata:mi. ↗
modelsummary
multcomp
mvtnorm
nlme
corAR1()— AR(1) Correlation Structure Stata:xtregar. ↗gls()— Fit Linear Model Using Generalized Least Squares Stata:hetregress. ↗lme()— Linear Mixed-Effects Models Stata:xtregar. ↗nlme()— Nonlinear Mixed-Effects Models Stata:menl. ↗varExp()— Exponential Variance Function Stata:hetregress. ↗varIdent()— Constant Variance Function Stata:xtgls. ↗
nnet
multinom()— Multinomial logit
oaxaca
oaxaca()— Blinder-Oaxaca decomposition
ordinal
clmm()— Cumulative Link Mixed Models Stata:meologit. ↗
patchwork
wrap_plots()— Combine several plots
plm
pdata.frame()— Declare panel data for plm Stata:xtset. ↗pgmm()— Dynamic panel GMM (Arellano-Bond)phtest()— Hausman test Stata:hausman. ↗plm()— Panel models: fixed and random effectsplmtest()— Lagrange FF Multiplier Tests for Panel Models Stata:xttest0. ↗purtest()— Unit root tests for panel data Stata:xtunitroot. ↗vcovBK()— Beck and Katz Robust Covariance Matrix Estimators Stata:xtpcse. ↗vcovHC()— Robust Covariance Matrix Estimators Stata:xtreg. ↗vcovSCC()— Driscoll and Kraay (1998) Robust Covariance Matrix Estimator Stata:xtreg. ↗
polycor
polychor()— Polychoric Correlation Stata:tetrachoric. ↗
pROC
pscl
zeroinfl()— Zero-inflated Count Data Regression Stata:zip. ↗
psych
alpha()— Cronbach’s alpha Stata:alpha. ↗cohen.kappa()— Find Cohen’s kappa and weighted kappa coefficients for correlation of two raters Stata:kap. ↗describe()— Summary statistics (unlike Stata’s describe) Stata:summarize. ↗fa()— Factor analysis with more methods Stata:factor. ↗ICC()— Intraclass Correlations (ICC1, ICC2, ICC3 from Shrout and Fleiss) Stata:icc. ↗KMO()— Find the Kaiser, Meyer, Olkin Measure of Sampling Adequacy Stata:estat. ↗mardia()— Calculate univariate or multivariate (Mardia’s test) skew and kurtosis for a vector, matrix, or data.frame Stata:mvtest. ↗principal()— Principal components analysis (PCA) Stata:factor. ↗
purrr
list_rbind()— Stack a list of data frames Stata:append. ↗map()— Apply a function to each element, returning a list Stata:foreach. ↗map2()— Apply a function to pairs of elements Stata:forvalues. ↗map_chr()— Apply a function to each element, returning text Stata:foreach. ↗map_dbl()— Apply a function to each element, returning numbers Stata:foreach. ↗possibly()— Return a default value instead of an error Stata:capture. ↗reduce()— Combine elements one after another, such as repeated merges Stata:merge. ↗walk()— Apply a function for its side effects, such as saving files Stata:foreach. ↗
pwr
ES.h()— Effect size calculation for proportions Stata:power. ↗pwr.anova.test()— Power calculations for balanced one-way analysis of variance tests Stata:power. ↗pwr.f2.test()— Power calculations for the general linear model Stata:power. ↗pwr.norm.test()— Power calculations for the mean of a normal distribution (known variance) Stata:power. ↗pwr.p.test()— Power calculations for proportion tests (one sample) Stata:power. ↗pwr.r.test()— Power calculations for correlation test Stata:power. ↗pwr.t2n.test()— Power calculations for two samples (different sizes) t-tests of means Stata:power. ↗
quantreg
rq()— Quantile regression
rddensity
rdrobust
rdbwselect()— Bandwidth Selection Procedures for Local Polynomial Regression Discontinuity Estimators Stata:rdbwselect. ↗rdrobust()— Regression discontinuity
readr
readxl
excel_sheets()— Sheet names of an Excel file Stata:import excel, describe. ↗read_excel()— Read an Excel sheet
remotes
install_github()— Install a package from GitHub
rprojroot
sampleSelection
selection()— Heckman sample-selection model
sandwich
sf
st_as_sf()— Convert foreign object to an sf object Stata:spset. ↗
srvyr
stats
acf()— Autocorrelation function Stata:corrgram. ↗addmargins()— Add totals to a table Stata:tabulate x1 x2. ↗aggregate()— Group statistics (base R) Stata:collapse. ↗AIC()— Akaike information criterionanova()— ANOVA table, or comparison of nested models Stata:anova. ↗aov()— Analysis of varianceapprox()— Interpolation Functions Stata:ipolate. ↗arima()— ARIMA time-series modelas.dist()— Distance Matrix Computation Stata:mdsmat. ↗ave()— Group Averages Over Level Combinations of Factors Stata:stgen. ↗bartlett.test()— Bartlett test of equal variances Stata:oneway. ↗BIC()— Bayesian information criterionbinom.test()— Exact binomial test Stata:bitest. ↗binomial()— Binomial family for logit and probit modelsBox.test()— #1BoxBox-#1PiercePierce and #1LjungLjung-#1BoxBox Tests Stata:wntestq. ↗cancor()— Canonical Correlations Stata:canon. ↗ccf()— Auto- and Cross- Covariance and -Correlation Function Estimation Stata:xcorr. ↗chisq.test()— Chi-square test Stata:tabulate x1 x2, chi2. ↗cmdscale()— Classical (Metric) Multidimensional Scaling Stata:mds. ↗coef()— Model coefficientscomplete.cases()— Rows with no missing values Stata:egen rowmiss(). ↗confint()— Confidence intervals of coefficients Stata:regress. ↗cooks.distance()— Regression Deletion Diagnostics Stata:predict. ↗cor()— Correlation matrixcor.test()— Correlation with a significance testcov()— Covariance Stata:correlate, covariance. ↗cov2cor()— Correlation, Variance and Covariance (Matrices) Stata:estat. ↗cutree()— Cut a Tree into Groups of Data Stata:cluster. ↗dbeta()— The Beta Distribution Stata:betaden. ↗dbinom()— The Binomial Distribution Stata:binomialp. ↗dcauchy()— The Cauchy Distribution Stata:cauchyden. ↗dchisq()— The (non-central) Chi-Squared Distribution Stata:chi2den. ↗density()— Kernel density estimate Stata:kdensity. ↗dexp()— The Exponential Distribution Stata:exponentialden. ↗df()— The F Distribution Stata:Fden. ↗dfbetas()— Regression Deletion Diagnostics Stata:dfbeta. ↗dffits()— Regression Deletion Diagnostics Stata:predict. ↗dgamma()— The Gamma Distribution Stata:gammaden. ↗dhyper()— The Hypergeometric Distribution Stata:hypergeometricp. ↗dist()— Distance Matrix Computation Stata:mds. ↗dlogis()— The Logistic Distribution Stata:logisticden. ↗dnbinom()— The Negative Binomial Distribution Stata:nbinomialp. ↗dnorm()— Normal density Stata:normalden(). ↗dpois()— The Poisson Distribution Stata:poissonp. ↗dt()— The Student t Distribution Stata:tden. ↗dweibull()— The Weibull Distribution Stata:weibullden. ↗ecdf()— Empirical cumulative distribution Stata:cumul. ↗expand.model.frame()— Retrieve additional variables aligned with a fitted model’s observations Stata:vce(cluster g). ↗factanal()— Factor analysisfilter()— Linear Filtering on a Time Series Stata:tssmooth. ↗fisher.test()— Fisher’s exact testfitted()— Fitted values of a modelftable()— Flat multi-way table Stata:table. ↗Gamma()— Family Objects for Models Stata:glm. ↗gaussian()— Family Objects for Models Stata:glm. ↗glm()— Generalised linear model, such as logit or Poissonhatvalues()— Regression Deletion Diagnostics Stata:predict. ↗hclust()— Hierarchical Clustering Stata:cluster. ↗HoltWinters()— Holt-Winters Filtering Stata:tssmooth. ↗inverse.gaussian()— Family Objects for Models Stata:glm. ↗IQR()— Interquartile range Stata:egen iqr(). ↗kmeans()— K-means clusteringkruskal.test()— Kruskal-Wallis testks.test()— Kolmogorov-Smirnov testlm()— Linear regressionlogLik()— Log-likelihood of a model Stata:e(ll). ↗lowess()— Lowess smoother Stata:lowess. ↗mad()— Median absolute deviation Stata:egen mad(). ↗manova()— Multivariate Analysis of Variance Stata:manova. ↗mantelhaen.test()— Cochran-Mantel-#1HaenszelHaenszel Chi-Squared Test for Count Data Stata:mhodds. ↗mcnemar.test()— McNemar test for paired proportions Stata:mcc. ↗median()— Medianmodel.frame()— Extracting the Model Frame from a Formula or Fit Stata:estat. ↗model.matrix()— Design matrix with dummy variables Stata:xi. ↗na.omit()— Drop rows with missing valuesnls()— Nonlinear least squares Stata:nl. ↗nobs()— Number of observations used by a model Stata:e(N). ↗offset()— Include an Offset in a Model Formula Stata:poisson. ↗optim()— General-purpose optimisation Stata:ml. ↗p.adjust()— Adjust p-values for multiple tests Stata:test, mtest. ↗pacf()— Auto- and Cross- Covariance and -Correlation Function Estimation Stata:pac. ↗pairwise.t.test()— Pairwise t tests with adjusted p-values Stata:pwmean. ↗pbeta()— The Beta Distribution Stata:ibeta. ↗pbinom()— The Binomial Distribution Stata:binomial. ↗pcauchy()— The Cauchy Distribution Stata:cauchy. ↗pchisq()— Chi-square probability Stata:chi2tail(). ↗pexp()— The Exponential Distribution Stata:exponential. ↗pf()— The F Distribution Stata:F. ↗pgamma()— The Gamma Distribution Stata:gammap. ↗phyper()— The Hypergeometric Distribution Stata:hypergeometric. ↗plogis()— The Logistic Distribution Stata:predictnl. ↗pnbinom()— The Negative Binomial Distribution Stata:nbinomial. ↗pnorm()— Normal cumulative probability Stata:normal(). ↗poisson()— Family Objects for Models Stata:glm. ↗poisson.test()— Exact Poisson tests Stata:stir. ↗poly()— Polynomial terms for a modelpower.prop.test()— Power Calculations for Two-Sample Test for Proportions Stata:power. ↗power.t.test()— Power and sample size for a t test Stata:power twomeans. ↗ppoints()— Ordinates for Probability Plotting Stata:quantile. ↗ppois()— The Poisson Distribution Stata:poisson. ↗prcomp()— Principal componentspredict()— Predictions from a modelprincomp()— Principal Components Analysis Stata:pcamat. ↗promax()— Rotation Methods for Factor Analysis Stata:rotate. ↗prop.test()— Test of a proportionprop.trend.test()— Test for trend in proportions Stata:nptrend. ↗pt()— t-distribution probability Stata:ttail(). ↗ptukey()— The Studentized Range Distribution Stata:tukeyprob. ↗pweibull()— The Weibull Distribution Stata:weibull. ↗qbeta()— The Beta Distribution Stata:invibeta. ↗qcauchy()— The Cauchy Distribution Stata:invcauchy. ↗qchisq()— The (non-central) Chi-Squared Distribution Stata:qchi. ↗qexp()— The Exponential Distribution Stata:invexponential. ↗qf()— The F Distribution Stata:invF. ↗qgamma()— The Gamma Distribution Stata:invgammap. ↗qlogis()— The Logistic Distribution Stata:invlogistic. ↗qnorm()— Normal quantile Stata:invnormal(). ↗qqplot()— Quantile-Quantile Plots Stata:qqplot. ↗qt()— The Student t Distribution Stata:invt. ↗qtukey()— The Studentized Range Distribution Stata:invtukeyprob. ↗quantile()— Quantiles Stata:pctile. ↗quasibinomial()— Binomial family that allows survey weightsquasipoisson()— Family Objects for Models Stata:svy. ↗qweibull()— The Weibull Distribution Stata:invweibull. ↗rbeta()— The Beta Distribution Stata:rbeta. ↗rbinom()— Binomial random numbers Stata:rbinomial(). ↗rcauchy()— The Cauchy Distribution Stata:rcauchy. ↗rchisq()— The (non-central) Chi-Squared Distribution Stata:rchi2. ↗relevel()— Choose the base category of a factorreshape()— Reshape Grouped Data Stata:icc. ↗residuals()— Model residuals Stata:predict, residuals. ↗rexp()— The Exponential Distribution Stata:rexponential. ↗rgamma()— The Gamma Distribution Stata:rgamma. ↗rhyper()— The Hypergeometric Distribution Stata:rhypergeometric. ↗rlogis()— The Logistic Distribution Stata:rlogistic. ↗rnbinom()— The Negative Binomial Distribution Stata:rnbinomial. ↗rnorm()— Normal random numbersrpois()— The Poisson Distribution Stata:rpoisson. ↗rstandard()— Regression Deletion Diagnostics Stata:predict. ↗rstudent()— Regression Deletion Diagnostics Stata:predict. ↗rt()— The Student t Distribution Stata:rt. ↗runif()— Uniform random numbersrunmed()— Running Medians – Robust Scatter Plot Smoothing Stata:tssmooth. ↗rweibull()— The Weibull Distribution Stata:rweibull. ↗sd()— Standard deviationsetNames()— Set the Names in an Object Stata:labmask. ↗shapiro.test()— Shapiro-Wilk normality testsigma()— Extract Residual Standard Deviation ‘Sigma’ Stata:estat. ↗spectrum()— Spectral Density Estimation Stata:pergram. ↗step()— Stepwise model selection Stata:stepwise. ↗StructTS()— Fit Structural Time Series Stata:sspace. ↗t.test()— t test and confidence interval of a meants()— Time-series object Stata:tsset. ↗TukeyHSD()— Tukey multiple comparisons Stata:pwcompare, mcompare(tukey). ↗uniroot()— One Dimensional Root (Zero) Finding Stata:ciwidth. ↗update()— Refit a model with changes Stata:regress. ↗var()— Variance Stata:summarize, detail. ↗var.test()— F test of equal variances Stata:sdtest. ↗varimax()— Rotation Methods for Factor Analysis Stata:rotate. ↗vcov()— Variance-covariance matrix of a modelweighted.mean()— Weighted mean Stata:summarize [aweight = w]. ↗wilcox.test()— Wilcoxon rank-sum or signed-rank testxtabs()— Cross-tabulation from a formula Stata:tabulate x1 x2. ↗
stringi
stringr
fixed()— Match text literally rather than as a regular expressionregex()— Regular expression with options such as ignore_casestr_c()— Join strings Stata:generate s = a + b. ↗str_count()— Count matches in a stringstr_detect()— Whether a string contains a patternstr_dup()— Repeat a string Stata:"-" * 10. ↗str_ends()— Whether a string ends with a pattern Stata:substr(). ↗str_extract()— Extract the matching textstr_extract_all()— Extract every match Stata:ustrregexs(). ↗str_flatten()— Collapse a vector into one string Stata:levelsof, separate(). ↗str_glue()— Fill a text template Stata:display "`x'". ↗str_length()— Number of charactersstr_locate()— Position of a match Stata:strpos(). ↗str_match()— Extract the groups of a regular expression Stata:regexs(). ↗str_pad()— Pad a string to a fixed width Stata:string(x, "%05.0f"). ↗str_remove()— Remove the first match Stata:subinstr(). ↗str_remove_all()— Remove every match Stata:subinstr(). ↗str_replace()— Replace the first matchstr_replace_all()— Replace every matchstr_split()— Split strings into pieces Stata:split. ↗str_squish()— Trim spaces and collapse repeated spacesstr_starts()— Whether a string starts with a pattern Stata:substr(). ↗str_sub()— Part of a string by positionstr_subset()— Keep the strings that match Stata:keep if regexm(). ↗str_to_lower()— Lower casestr_to_sentence()— Sentence case Stata:strproper(). ↗str_to_title()— Title casestr_to_upper()— Upper casestr_trim()— Remove leading and trailing spacesstr_trunc()— Shorten strings to a width Stata:abbrev(). ↗str_wrap()— Wrap text into lines Stata:display. ↗word()— Extract words from a sentence
survey
as.svrepdesign()— Convert a survey design to use replicate weights Stata:svyset. ↗cv()— Summary statistics for sample surveys Stata:estat. ↗deff()— Summary statistics for sample surveys Stata:estat. ↗degf()— Contingency tables for survey data Stata:svydescribe. ↗postStratify()— Post-stratify a survey Stata:svyset. ↗rake()— Raking of replicate weight design Stata:svyset. ↗svyby()— Survey statistics on subsets Stata:svy. ↗svychisq()— Contingency tables for survey data Stata:svy. ↗svyciprop()— Confidence intervals for proportions Stata:svy. ↗svydesign()— Declare a survey design (survey package) Stata:svyset. ↗svyglm()— Survey-weighted regressionsvymean()— Survey-weighted mean (survey package) Stata:svy: mean. ↗svyratio()— Ratio estimation Stata:svy. ↗svytable()— Survey-weighted table Stata:svy: tabulate. ↗svytotal()— Summary statistics for sample surveys Stata:svy. ↗
survival
basehaz()— Alias for the survfit function Stata:predict. ↗clogit()— Conditional logitconcordance()— Compute the concordance statistic for data or a model Stata:estat. ↗cox.zph()— Test the Proportional Hazards Assumption of a Cox Regression Stata:estat. ↗coxph()— Cox proportional hazards modelfinegray()— Create data for a Fine-Gray model Stata:stcrreg. ↗frailty()— Random effects terms Stata:stcox. ↗strata()— Stratum term in a survival model formulaSurv()— Survival-time outcome for a modelsurvdiff()— Log-rank testsurvfit()— Kaplan-Meier survival curvessurvreg()— Parametric survival modelsurvSplit()— Split a survival data set at specified times Stata:stsplit. ↗
Synth
synth()— Synthetic control
tibble
tidyr
complete()— Add rows for missing combinations of valuescrossing()— All combinations, sorted and unique Stata:cross. ↗drop_na()— Drop rows with missing values Stata:drop if missing(x). ↗expand()— All combinations of values, dropping other columns Stata:fillin. ↗expand_grid()— Table of every combination of given values Stata:cross. ↗fill()— Fill missing values with the previous or next valuefull_seq()— Complete sequence of values Stata:tsfill. ↗nest()— Nest rows into list-columns, one row per group Stata:by. ↗pivot_longer()— Reshape from wide to longpivot_wider()— Reshape from long to widereplace_na()— Replace missing values Stata:replace x = 0 if missing(x). ↗separate_longer_delim()— Split text into rows Stata:split. ↗separate_wider_delim()— Split one text column into severalseparate_wider_position()— Split text into columns by position Stata:substr(). ↗uncount()— Repeat each row a given number of timesunite()— Join columns into one Stata:egen concat(). ↗unnest()— Expand list-columns back into rows Stata:expand. ↗
tidystata
as_character()— Alias of decode() Stata:decode. ↗as_dummy()— Dummy variables for every categoryas_numeric()— Alias of destring() Stata:destring. ↗assert()— Stop and count the rows where a condition failsbrowse()— View data in a spreadsheet windowcapture()— Run code and return TRUE or FALSE instead of stopping on an errorcodebook()— Describe every variable: type, label, counts and valuescut_quantile()— Alias of xtile() Stata:xtile. ↗decode()— Convert to text, using value labels for labelled datadestring()— Convert to numbers, dropping value labelsds()— List variable namesduplicates_drop()— Drop duplicated rows, keeping the firstduplicates_list()— List duplicated rowsduplicates_report()— Count duplicated rowsduplicates_tag()— Mark duplicated rowsfindit()— Find the R equivalent of a Stata commandfre()— Frequency table with a total rowfre2()— Two-way cross-tabulation with row and column totals Stata:tabulate. ↗is_first()— Mark the first row of each groupisid()— Check that variables uniquely identify the rowsmisstable()— Missing values per variable, or missing-value patternsmvdecode()— Turn given codes into missing valuesmvencode()— Replace missing values with a codena_if_value()— Alias of mvdecode() Stata:mvdecode. ↗pc()— Percentage of the totalpct()— Alias of pc() Stata:egen pc(). ↗print_all()— Print every row and columnpwcorr()— Pairwise correlations with counts and p-valuesrow_max()— Maximum across variables in each rowrow_mean()— Mean across variables in each rowrow_median()— Median across variables in each rowrow_min()— Minimum across variables in each rowrow_miss()— Number of missing values in each rowrow_non_miss()— Number of observed values in each rowrow_nvals()— Number of distinct values in each row, ignoring missing valuesrow_sd()— Standard deviation across variables in each rowrow_sum()— Sum across variables in each rowrow_unique()— Number of distinct values in each row, counting missing as one Stata:egen rownvals(). ↗set_seed()— Set the random seed, alone or at the end of a pipestata_diff()— Difference from the previous period, respecting time gapsstata_lag()— Value from an earlier period, respecting time gapsstata_lead()— Value from a later period, respecting time gapsstata_merge()— Merge two tables and report matches, like Stata’s mergestd()— Standardise to mean 0 and standard deviation 1summ()— Summary statistics for variablestab()— Frequency tabletab1()— One frequency table per variabletab2()— Two-way cross-tabulation, or every pairwise tabletab_gen()— Alias of as_dummy() Stata:tabulate, generate(). ↗tabstat()— Chosen statistics for variables, optionally by grouptimer()— Time how long code takestostring()— Convert to text, keeping codes rather than value labelsvalue_if_na()— Alias of mvencode() Stata:mvencode. ↗variables()— List variables with their types and labelsvariables_search()— Find variables by name or labelvarlist()— Select variables with Stata wildcards such as x*xtile()— Quantile groups, following Stata’s xtile
tools
md5sum()— Compute MD5 Checksums Stata:checksum. ↗
tseries
garch()— Fit GARCH Models to Time Series Stata:arch. ↗
tsibble
as_tsibble()— Declare time-series or panel datafill_gaps()— Add rows for missing time pointsyearmonth()— Monthly periodyearquarter()— Quarterly period
urca
ca.jo()— Johansen Procedure for VAR Stata:vecrank. ↗cajorls()— OLS regression of VECM Stata:vec. ↗ur.df()— Augmented-Dickey-Fuller Unit Root Test Stata:dfuller. ↗ur.ers()— Elliott, Rothenberg and Stock Unit Root Test Stata:dfgls. ↗ur.pp()— Phillips and Perron Unit Root Test Stata:pperron. ↗
utils
capture.output()— Send Output to a Character String or File Stata:dataex. ↗combn()— Generate All Combinations of n Elements, Taken m at a Time Stata:tab2. ↗data()— Load a built-in example datasetgetAnywhere()— Find where a function is definedglob2rx()— Turn a wildcard pattern into a regular expressionhead()— First rowshelp()— Open a help pagehelp.search()— Search all installed help pagesinstall.packages()— Install a package from CRANobject.size()— Report the Space Allocated for an Object Stata:memory. ↗packageVersion()— Package Description Stata:ftools. ↗read.csv()— Read a CSV file (base R) Stata:import delimited. ↗read.delim()— Data Input Stata:import. ↗read.fwf()— Read Fixed Width Format Files Stata:infix. ↗read.table()— Data Input Stata:infile. ↗sessionInfo()— Collect Information About the Current R Session Stata:about. ↗str()— Compact view of an object’s structuretail()— Last rowsunzip()— Extract or List Zip Archives Stata:unzipfile. ↗update.packages()— Update installed packagesView()— Open the data viewer Stata:browse. ↗write.csv()— Write a CSV file (base R) Stata:export delimited. ↗write.table()— Data Output Stata:outfile. ↗
VGAM
binom2.rho()— Bivariate Probit Regression Stata:biprobit. ↗cens.poisson()— Censored Poisson Family Function Stata:cpoisson. ↗multinomial()— Multinomial Logit Model Stata:slogit. ↗posnegbinomial()— Positive Negative Binomial Distribution Family Function Stata:tnbreg. ↗posnormal()— Positive Normal Distribution Family Function Stata:truncreg. ↗pospoisson()— Positive Poisson Distribution Family Function Stata:tpoisson. ↗rrvglm()— Fitting Reduced-Rank Vector Generalized Linear Models (RR-VGLMs) and Doubly Constrained RR-VGLMs (DRR-VGLMs) Stata:slogit. ↗SurvS4()— Create a Survival Object Stata:cpoisson. ↗vglm()— Fitting Vector Generalized Linear Models Stata:tpoisson. ↗
WeightIt
weightit()— Balancing weights, such as inverse-probability weights
writexl
write_xlsx()— Write an Excel file
zip
zipr()— Compress Files into ‘zip’ Archives Stata:zipfile. ↗