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 text
  • as.data.frame() — Coerce to a Data Frame Stata: getmata. ↗
  • as.Date() — Convert to a date
  • as.double() — Convert to double-precision numbers
  • as.factor() — Convert to a factor Stata: encode. ↗
  • as.integer() — Convert to whole numbers
  • as.matrix() — Matrices Stata: cf. ↗
  • as.numeric() — Convert to numbers
  • as.POSIXct() — Date-time Conversion Functions Stata: clock. ↗
  • as.vector() — Vectors - Creation, Coercion, etc Stata: margins. ↗
  • attr() — Get or set an attribute of an object
  • attributes() — Object Attribute Lists Stata: char. ↗
  • body() — Access to and Manipulation of the Body of a Function Stata: viewsource. ↗
  • c() — Combine values into a vector
  • cat() — Print text without quotes
  • cbind() — Put side by side (base R) Stata: merge 1:1 _n. ↗
  • ceiling() — Round up
  • character() — 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 sum
  • cut() — Cut numbers into intervals
  • data.frame() — Data Frames Stata: range. ↗
  • diag() — Diagonal of a matrix
  • diff() — Differences between neighbouring values Stata: D.. ↗
  • dim() — Numbers of rows and columns Stata: describe. ↗
  • dir() — List files in a folder
  • dir.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 levels
  • file() — 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 down
  • format() — Format values for display
  • formatC() — Format numbers with width and padding Stata: string(x, "%9.2f"). ↗
  • getwd() — Show the working directory
  • grep() — Pattern Matching and Replacement Stata: unab. ↗
  • grepl() — Whether text matches a pattern
  • gsub() — 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 missing
  • is.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 factor
  • library() — Attach a package Stata: ssc install. ↗
  • list() — A list of objects
  • list.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 memory
  • make.names() — Turn text into valid names
  • mapply() — 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 matrix
  • max() — Largest value
  • mean() — Mean
  • merge() — Merge two data frames (base R) Stata: merge. ↗
  • message() — Print a message Stata: display. ↗
  • min() — Smallest value
  • Mod() — Complex Numbers and Basic Functionality Stata: psdensity. ↗
  • names() — Names of an object, such as column names
  • nchar() — 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 rows
  • numeric() — Numeric Vectors Stata: rangestat. ↗
  • options() — Set global options Stata: set. ↗
  • order() — Positions that would sort a vector Stata: sort. ↗
  • paste() — Join text with a separator
  • paste0() — Join text without a separator
  • plot() — Basic plot
  • pmatch() — 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 object
  • prop.table() — Turn counts into proportions
  • proportions() — 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 averaged
  • rbind() — 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 length
  • replace() — 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 memory
  • round() — Round to a number of decimals
  • row() — Row Indexes Stata: spmatrix. ↗
  • rowMeans() — Form Row and Column Sums and Means Stata: egen. ↗
  • rowSums() — Sum across columns in each row
  • sample() — 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 file
  • scale() — Standardise columns Stata: egen std(). ↗
  • scan() — Read Data Values Stata: tokenize. ↗
  • seq() — Sequence of numbers
  • seq_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 reproducible
  • setwd() — Change the working directory
  • sign() — Sign Function Stata: compare. ↗
  • signif() — Round to significant digits Stata: round(). ↗
  • sin() — Trigonometric Functions Stata: tsfilter. ↗
  • sink() — Send console output to a file
  • solve() — Solve a System of Equations Stata: estat. ↗
  • sort() — Sort a vector
  • source() — Run an R script
  • split() — Split data into groups Stata: by. ↗
  • sprintf() — Format numbers and text with a template
  • sqrt() — Square root
  • stop() — Stop with an error Stata: exit 198. ↗
  • stopifnot() — Stop if a condition is not TRUE
  • strsplit() — 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() — Sum
  • summary() — Summary of an object, such as a model
  • Sys.Date() — Today’s date
  • Sys.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 matrix
  • table() — Count values
  • tapply() — Apply a function within groups Stata: bysort g: egen. ↗
  • tempdir() — Create Names for Temporary Files Stata: sysdir. ↗
  • tempfile() — Name for a temporary file
  • tolower() — Lower case Stata: strlower(). ↗
  • toupper() — Upper case Stata: strupper(). ↗
  • traceback() — Show where the last error happened
  • transform() — 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 values
  • unname() — 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 frame
  • writeBin() — 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

  • boot() — Bootstrap Resampling Stata: centile. ↗
  • boot.ci() — Nonparametric Bootstrap Confidence Intervals Stata: centile. ↗

broom

  • augment() — Add fitted values and residuals to the data Stata: predict. ↗
  • glance() — One-row summary of model statistics
  • tidy() — Coefficient table as a data frame

car

  • Anova() — Type II and III ANOVA tables Stata: anova. ↗
  • avPlots() — Added-variable plots
  • deltaMethod() — 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

  • effectiveSize() — Effective sample size for estimating the mean Stata: bayesstats. ↗
  • HPDinterval() — Highest Posterior Density intervals Stata: bayesstats. ↗

data.table

  • fread() — Fast reading of large text files Stata: import delimited. ↗
  • fwrite() — Fast writing of large text files Stata: export delimited. ↗

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 columns
  • add_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 second
  • any_of() — Select listed columns that exist Stata: capture keep. ↗
  • arrange() — Sort rows
  • between() — Whether values lie within a range
  • bind_cols() — Put tables side by side
  • bind_rows() — Stack tables on top of each other
  • c_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 step
  • coalesce() — First non-missing value across vectors
  • consecutive_id() — Number runs of identical values Stata: tsspell. ↗
  • contains() — Select columns whose names contain some text
  • count() — Count rows in each group
  • cross_join() — Every combination of rows from two tables
  • cumall() — 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 group
  • dense_rank() — Ranks without gaps Stata: egen group(). ↗
  • desc() — Sort in descending order inside arrange()
  • distinct() — Keep unique rows
  • ends_with() — Select columns whose names end with some text
  • everything() — Select all columns Stata: _all. ↗
  • filter() — Keep rows that meet a condition
  • first() — First value Stata: x[1]. ↗
  • full_join() — Merge keeping all rows of both tables
  • glimpse() — Compact view of all columns Stata: describe. ↗
  • group_by() — Group rows so later steps work within groups
  • group_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 not
  • inner_join() — Merge keeping only matched rows
  • intersect() — Rows in both tables Stata: merge, keep(match). ↗
  • join_by() — Join keys, including inequality and range joins Stata: joinby. ↗
  • lag() — Value from the previous row
  • last() — Last value Stata: x[_N]. ↗
  • last_col() — The last column Stata: order. ↗
  • lead() — Value from the next row
  • left_join() — Merge keeping all rows of the first table
  • matches() — Select columns whose names match a regular expression
  • min_rank() — Ranks with ties given the lowest rank Stata: egen rank(), track. ↗
  • mutate() — Create or change columns
  • n() — Number of rows in the current group
  • n_distinct() — Number of distinct values Stata: distinct. ↗
  • na_if() — Turn one value into missing
  • near() — 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 vector
  • reframe() — Summarise to any number of rows per group Stata: collapse. ↗
  • relocate() — Move columns to a new position
  • rename() — Rename columns (new = old)
  • rename_with() — Rename columns with a function, such as toupper
  • right_join() — Merge keeping all rows of the second table
  • row_number() — Row number
  • rows_update() — Update rows from another table Stata: merge, update replace. ↗
  • rowwise() — Compute row by row Stata: egen rowmean(). ↗
  • select() — Keep or drop columns
  • semi_join() — Keep rows of the first table that have a match in the second
  • setdiff() — Rows in the first table only Stata: merge, keep(master). ↗
  • slice() — Keep rows by position
  • slice_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 rows
  • slice_tail() — Last rows of each group Stata: bysort g: keep if _n > _N - 3. ↗
  • starts_with() — Select columns whose names start with some text
  • summarise() — Reduce each group to one row of statistics
  • summarize() — Same as summarise() Stata: collapse. ↗
  • tally() — Count rows Stata: count. ↗
  • transmute() — Create columns and keep only those Stata: keep. ↗
  • ungroup() — Remove grouping
  • union() — 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 IV
  • fepois() — Poisson regression with fixed effects
  • fitstat() — Fit statistics, including the first-stage F Stata: estat firststage. ↗
  • sunab() — Sun and Abraham interactions Stata: eventstudyinteract. ↗

flextable

  • flextable() — Formatted table for Word or PowerPoint
  • save_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

  • Arima() — Fit ARIMA model to univariate time series Stata: forecast. ↗
  • forecast() — Objects exported from other packages Stata: 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 features
  • after_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 axes
  • coord_polar() — Polar coordinates, used for pie charts
  • facet_grid() — Panels by two variables Stata: by(). ↗
  • facet_wrap() — One panel per group
  • geom_abline() — Line with a given slope and intercept Stata: function. ↗
  • geom_area() — Area plot
  • geom_bar() — Bar chart of counts
  • geom_boxplot() — Box plot
  • geom_col() — Bars with given heights Stata: graph bar (asis). ↗
  • geom_contour() — 2D contours of a 3D surface Stata: twoway. ↗
  • geom_density() — Density curve
  • geom_errorbar() — Error bars or capped ranges
  • geom_histogram() — Histogram
  • geom_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 observations
  • geom_linerange() — Vertical intervals: lines, crossbars & errorbars Stata: twoway. ↗
  • geom_point() — Points (scatter plot)
  • geom_pointrange() — Points with intervals Stata: rcap. ↗
  • geom_qq() — Quantile-quantile points
  • geom_qq_line() — Reference line for a quantile-quantile plot
  • geom_rect() — Rectangles Stata: twoway. ↗
  • geom_ribbon() — Shaded band between two values
  • geom_segment() — Line segments and curves Stata: twoway. ↗
  • geom_sf() — Map from spatial data Stata: spmap. ↗
  • geom_smooth() — Fitted line or smooth curve
  • geom_step() — Step plot Stata: line, connect(stairstep). ↗
  • geom_text() — Text labels on a plot
  • geom_tile() — Heat-map tiles Stata: heatplot. ↗
  • geom_violin() — Violin plot
  • geom_vline() — Vertical reference line
  • ggplot() — Start a plot
  • ggsave() — Save a plot to a file
  • labs() — 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 x
  • stat_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 theme
  • theme_classic() — Classic plot theme Stata: set scheme. ↗
  • theme_minimal() — Minimal plot theme Stata: set scheme. ↗
  • theme_set() — Set the default theme for every plot
  • xlim() — Limits of the x axis Stata: xscale(range()). ↗

glmmTMB

  • glmmTMB() — Fit Models with TMB Stata: menbreg. ↗
  • nbinom2() — Family functions for glmmTMB Stata: menbreg. ↗

glmnet

  • cv.glmnet() — Cross-validation for glmnet Stata: lasso. ↗

GPArotation

  • oblimin() — Rotations Functions Using Gradient Projection Algorithms Stata: rotate. ↗
  • quartimax() — Rotations Functions Using Gradient Projection Algorithms Stata: rotate. ↗

graphics

  • pairs() — Scatter-plot matrix
  • plot() — The Default Scatterplot Function Stata: quantile. ↗
  • stem() — Stem-and-leaf display

grid

  • arrow() — Describe arrows to add to a line Stata: twoway. ↗

gtsummary

  • tbl_cross() — Cross table Stata: tabulate x1 x2. ↗
  • tbl_regression() — Regression table Stata: esttab. ↗
  • tbl_summary() — Descriptive Table 1

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 vector
  • print_labels() — Show value labels Stata: label list. ↗
  • read_dta() — Read a Stata .dta file
  • read_sas() — Read a SAS file
  • read_sav() — Read an SPSS .sav file
  • read_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 file
  • write_sav() — Write an SPSS file Stata: savespss. ↗
  • write_xpt() — Read and write SAS transport files Stata: export. ↗
  • zap_labels() — Remove value labels
  • zap_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 labels
  • to_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 model
  • standardizedSolution() — Standardized Solution Stata: sem. ↗

lme4

  • fixef() — Extract fixed-effects estimates Stata: quadchk. ↗
  • glmer() — Multilevel generalised linear model
  • glmerControl() — Control of Mixed Model Fitting Stata: melogit. ↗
  • lmer() — Multilevel linear model
  • ranef() — Predicted random effects Stata: predict, reffects. ↗
  • VarCorr() — Variance components of a multilevel model Stata: estat sd. ↗

lmtest

  • bptest() — Breusch-Pagan test for heteroskedasticity
  • coeftest() — Coefficient tests with a chosen variance matrix
  • grangertest() — Test for Granger Causality Stata: vargranger. ↗
  • lrtest() — Likelihood-ratio test
  • resettest() — RESET test for omitted variables
  • waldtest() — Wald test of nested models Stata: test. ↗

lubridate

  • as_date() — Convert to a date Stata: dofc(). ↗
  • day() — Day of the month
  • days() — 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 dates
  • make_date() — Date from year, month and day
  • make_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 date
  • now() — 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 years
  • today() — Today’s date Stata: today(). ↗
  • wday() — Day of the week
  • week() — Week of the year Stata: week(). ↗
  • yday() — Day of the year Stata: doy(). ↗
  • year() — Year of a date
  • years() — A period of years, for date arithmetic Stata: d + 365. ↗
  • ymd() — Parse text such as 2024-01-31 into a date
  • ymd_hms() — Parse text into a date-time

marginaleffects

  • avg_comparisons() — Average contrasts Stata: margins r.x. ↗
  • avg_predictions() — Average predictions, like Stata’s margins
  • avg_slopes() — Average marginal effects
  • comparisons() — Differences between predictions (contrasts) Stata: margins r.x. ↗
  • hypotheses() — Tests of linear and nonlinear hypotheses
  • plot_predictions() — Plot predictions, like marginsplot
  • plot_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 regression
  • isoMDS() — 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 probit
  • qda() — 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 equations
  • pool() — Combine results across imputations
  • pool.scalar() — Multiple imputation pooling: univariate version Stata: mi. ↗

mitools

  • MIcombine() — Multiple imputation inference Stata: mi. ↗

modelsummary

  • datasummary() — Custom summary-statistics tables Stata: tabstat. ↗
  • datasummary_skim() — Quick overview of all variables Stata: codebook. ↗
  • modelplot() — Coefficient plot
  • modelsummary() — Regression and summary tables

multcomp

  • glht() — General Linear Hypotheses Stata: contrast. ↗
  • mcp() — General Linear Hypotheses Stata: contrast. ↗

mvtnorm

  • dmvnorm() — Multivariate Normal Density and Random Deviates Stata: lnmvnormalden. ↗
  • pmvnorm() — Multivariate Normal Distribution Stata: binormal. ↗

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 effects
  • plmtest() — 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

  • coords() — Coordinates of a ROC curve Stata: roctab. ↗
  • roc() — Build a ROC curve Stata: roctab. ↗
  • roc.test() — Compare two ROC curves Stata: roccomp. ↗

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

  • rdbwdensity() — Bandwidth Selection for Manipulation Testing Stata: rdbwdensity. ↗
  • rddensity() — Manipulation Testing Using Local Polynomial Density Estimation Stata: rddensity. ↗

rdrobust

  • rdbwselect() — Bandwidth Selection Procedures for Local Polynomial Regression Discontinuity Estimators Stata: rdbwselect. ↗
  • rdrobust() — Regression discontinuity

readr

  • parse_number() — Extract a number from text such as $1,200 Stata: destring, ignore(). ↗
  • read_csv() — Read a CSV file
  • read_delim() — Read a file with any delimiter Stata: import delimited. ↗
  • read_tsv() — Read a tab-separated file Stata: import delimited. ↗
  • write_csv() — Write a CSV file

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

  • find_root() — Find the root of a directory hierarchy Stata: setroot. ↗
  • has_file() — Is a directory the project root? Stata: setroot. ↗

sampleSelection

  • selection() — Heckman sample-selection model

sandwich

  • NeweyWest() — Newey-West HAC Covariance Matrix Estimation Stata: newey. ↗
  • vcovBS() — Bootstrap variance matrix
  • vcovCL() — Clustered variance matrix Stata: vce(cluster id). ↗
  • vcovHC() — Heteroskedasticity-robust variance matrix Stata: vce(robust). ↗
  • vcovJK() — Jackknife variance matrix

sf

  • st_as_sf() — Convert foreign object to an sf object Stata: spset. ↗

srvyr

  • as_survey_design() — Declare a survey design
  • survey_mean() — Survey-weighted mean
  • survey_prop() — Survey-weighted proportion
  • survey_quantile() — Survey-weighted quantiles Stata: epctile. ↗
  • survey_total() — Survey-weighted total Stata: svy: total. ↗

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 criterion
  • anova() — ANOVA table, or comparison of nested models Stata: anova. ↗
  • aov() — Analysis of variance
  • approx() — Interpolation Functions Stata: ipolate. ↗
  • arima() — ARIMA time-series model
  • as.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 criterion
  • binom.test() — Exact binomial test Stata: bitest. ↗
  • binomial() — Binomial family for logit and probit models
  • Box.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 coefficients
  • complete.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 matrix
  • cor.test() — Correlation with a significance test
  • cov() — 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 analysis
  • filter() — Linear Filtering on a Time Series Stata: tssmooth. ↗
  • fisher.test() — Fisher’s exact test
  • fitted() — Fitted values of a model
  • ftable() — 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 Poisson
  • hatvalues() — 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 clustering
  • kruskal.test() — Kruskal-Wallis test
  • ks.test() — Kolmogorov-Smirnov test
  • lm() — Linear regression
  • logLik() — 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() — Median
  • model.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 values
  • nls() — 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 model
  • power.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 components
  • predict() — Predictions from a model
  • princomp() — Principal Components Analysis Stata: pcamat. ↗
  • promax() — Rotation Methods for Factor Analysis Stata: rotate. ↗
  • prop.test() — Test of a proportion
  • prop.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 weights
  • quasipoisson() — 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 factor
  • reshape() — 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 numbers
  • rpois() — 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 numbers
  • runmed() — Running Medians – Robust Scatter Plot Smoothing Stata: tssmooth. ↗
  • rweibull() — The Weibull Distribution Stata: rweibull. ↗
  • sd() — Standard deviation
  • setNames() — Set the Names in an Object Stata: labmask. ↗
  • shapiro.test() — Shapiro-Wilk normality test
  • sigma() — 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 mean
  • ts() — 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 model
  • weighted.mean() — Weighted mean Stata: summarize [aweight = w]. ↗
  • wilcox.test() — Wilcoxon rank-sum or signed-rank test
  • xtabs() — Cross-tabulation from a formula Stata: tabulate x1 x2. ↗

stringi

  • stri_reverse() — Reverse Each String Stata: ustrreverse. ↗
  • stri_trans_nfc() — Perform or Check For Unicode Normalization Stata: ustrnormalize. ↗
  • stri_trans_nfkc() — Perform or Check For Unicode Normalization Stata: ustrnormalize. ↗

stringr

  • fixed() — Match text literally rather than as a regular expression
  • regex() — Regular expression with options such as ignore_case
  • str_c() — Join strings Stata: generate s = a + b. ↗
  • str_count() — Count matches in a string
  • str_detect() — Whether a string contains a pattern
  • str_dup() — Repeat a string Stata: "-" * 10. ↗
  • str_ends() — Whether a string ends with a pattern Stata: substr(). ↗
  • str_extract() — Extract the matching text
  • str_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 characters
  • str_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 match
  • str_replace_all() — Replace every match
  • str_split() — Split strings into pieces Stata: split. ↗
  • str_squish() — Trim spaces and collapse repeated spaces
  • str_starts() — Whether a string starts with a pattern Stata: substr(). ↗
  • str_sub() — Part of a string by position
  • str_subset() — Keep the strings that match Stata: keep if regexm(). ↗
  • str_to_lower() — Lower case
  • str_to_sentence() — Sentence case Stata: strproper(). ↗
  • str_to_title() — Title case
  • str_to_upper() — Upper case
  • str_trim() — Remove leading and trailing spaces
  • str_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 regression
  • svymean() — 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 logit
  • concordance() — 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 model
  • finegray() — Create data for a Fine-Gray model Stata: stcrreg. ↗
  • frailty() — Random effects terms Stata: stcox. ↗
  • strata() — Stratum term in a survival model formula
  • Surv() — Survival-time outcome for a model
  • survdiff() — Log-rank test
  • survfit() — Kaplan-Meier survival curves
  • survreg() — Parametric survival model
  • survSplit() — Split a survival data set at specified times Stata: stsplit. ↗

Synth

  • synth() — Synthetic control

tibble

  • add_row() — Add rows to a table Stata: set obs. ↗
  • as_tibble() — Convert to a tibble
  • rownames_to_column() — Turn row names into a column Stata: xpose. ↗
  • tibble() — Create a data frame (tibble)
  • tribble() — Type a small table row by row Stata: input. ↗

tidyr

  • complete() — Add rows for missing combinations of values
  • crossing() — 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 value
  • full_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 long
  • pivot_wider() — Reshape from long to wide
  • replace_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 several
  • separate_wider_position() — Split text into columns by position Stata: substr(). ↗
  • uncount() — Repeat each row a given number of times
  • unite() — 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 category
  • as_numeric() — Alias of destring() Stata: destring. ↗
  • assert() — Stop and count the rows where a condition fails
  • browse() — View data in a spreadsheet window
  • capture() — Run code and return TRUE or FALSE instead of stopping on an error
  • codebook() — Describe every variable: type, label, counts and values
  • cut_quantile() — Alias of xtile() Stata: xtile. ↗
  • decode() — Convert to text, using value labels for labelled data
  • destring() — Convert to numbers, dropping value labels
  • ds() — List variable names
  • duplicates_drop() — Drop duplicated rows, keeping the first
  • duplicates_list() — List duplicated rows
  • duplicates_report() — Count duplicated rows
  • duplicates_tag() — Mark duplicated rows
  • findit() — Find the R equivalent of a Stata command
  • fre() — Frequency table with a total row
  • fre2() — Two-way cross-tabulation with row and column totals Stata: tabulate. ↗
  • is_first() — Mark the first row of each group
  • isid() — Check that variables uniquely identify the rows
  • misstable() — Missing values per variable, or missing-value patterns
  • mvdecode() — Turn given codes into missing values
  • mvencode() — Replace missing values with a code
  • na_if_value() — Alias of mvdecode() Stata: mvdecode. ↗
  • pc() — Percentage of the total
  • pct() — Alias of pc() Stata: egen pc(). ↗
  • print_all() — Print every row and column
  • pwcorr() — Pairwise correlations with counts and p-values
  • row_max() — Maximum across variables in each row
  • row_mean() — Mean across variables in each row
  • row_median() — Median across variables in each row
  • row_min() — Minimum across variables in each row
  • row_miss() — Number of missing values in each row
  • row_non_miss() — Number of observed values in each row
  • row_nvals() — Number of distinct values in each row, ignoring missing values
  • row_sd() — Standard deviation across variables in each row
  • row_sum() — Sum across variables in each row
  • row_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 pipe
  • stata_diff() — Difference from the previous period, respecting time gaps
  • stata_lag() — Value from an earlier period, respecting time gaps
  • stata_lead() — Value from a later period, respecting time gaps
  • stata_merge() — Merge two tables and report matches, like Stata’s merge
  • std() — Standardise to mean 0 and standard deviation 1
  • summ() — Summary statistics for variables
  • tab() — Frequency table
  • tab1() — One frequency table per variable
  • tab2() — Two-way cross-tabulation, or every pairwise table
  • tab_gen() — Alias of as_dummy() Stata: tabulate, generate(). ↗
  • tabstat() — Chosen statistics for variables, optionally by group
  • timer() — Time how long code takes
  • tostring() — Convert to text, keeping codes rather than value labels
  • value_if_na() — Alias of mvencode() Stata: mvencode. ↗
  • variables() — List variables with their types and labels
  • variables_search() — Find variables by name or label
  • varlist() — 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 data
  • fill_gaps() — Add rows for missing time points
  • yearmonth() — Monthly period
  • yearquarter() — 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 dataset
  • getAnywhere() — Find where a function is defined
  • glob2rx() — Turn a wildcard pattern into a regular expression
  • head() — First rows
  • help() — Open a help page
  • help.search() — Search all installed help pages
  • install.packages() — Install a package from CRAN
  • object.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 structure
  • tail() — Last rows
  • unzip() — Extract or List Zip Archives Stata: unzipfile. ↗
  • update.packages() — Update installed packages
  • View() — 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. ↗

zoo

  • na.locf() — Last Observation Carried Forward Stata: stfill. ↗
  • rollapply() — Apply Rolling Functions Stata: rolling. ↗