Below is a short list of basic, commonly-used Excel formulas and their R counterparts. The R functions are part of Base R, in that they do no require third-party packages. This is not an exhaustive list by any stretch.
Basic Arithmetic Functions
Excel formula | R function |
---|---|
SUM | sum |
AVERAGE | mean |
COUNTA | length |
MAX | max (sometimes pmax) |
MIN | min (sometimes pmin) |
STDEV | sd |
ABS | abs |
CEILING, ROUNDUP | ceiling |
FLOOR, ROUNDDOWN | floor |
ROUND | round |
EXP | exp |
LOG, LN | log |
SQRT | sqrt |
Basic Text Functions
Excel formula | R function |
---|---|
CONCATENATE | paste |
LEFT, MID, RIGHT | substr |
LOWER | tolower |
UPPER | toupper |
LEN | nchar |
FIND | grepl, grep and others |
REPLACE | gsub and others |
More Formulas
Excel formula | R function |
---|---|
ISNA | is.na |
MATCH | which |
REPT | rep |
RANK | rank |
VLOOKUP | merge (sort of) |
Excel Features
Here are some Excel features and some of their close counterparts in R:
Excel Feature | R function(s) |
---|---|
Format Cells | as.Date, as.numeric, as.character (sort of) |
Navigating / inspecting table | head, tail, str, summary, dim, nrow |
Text to Columns | strsplit (sort of) |
GOOD FORMULA