# R Functions List (+ Examples) | All Basic Commands of the R Programming Language

There are thousands and thousands of functions in the R programming language available – And every day more commands are added to the Cran homepage.

To bring some light into the dark of the R jungle, I’ll provide you in the following with a (very incomplete) list of some of the **most popular and useful R functions**.

For many of these functions, I have created **tutorials with quick examples**. Just click on the function you are interested in, in order to get more information.

Let me know in the comments, in case you are interested in any particular function. I’ll try my best to publish a tutorial for this function as soon as possible.

## List of R Commands & Functions

- abs – Compute the absolute value of a numeric data object.
- all – Check whether all values of a logical vector are TRUE.
- anti_join [dplyr] – Anti join two data frames.
- any – Check whether any values of a logical vector are TRUE.
- apropos – Return character vector with names of objects that contain the input.
- attach – Give access to variables of a data.frame.
- attr – Return or set a specific attribute of a data object.
- attributes – Return or set all attributes of a data object.
- as.factor – Convert a data object to the class factor.
- as.numeric – Convert a data object to the class numeric.
- break – Break for-loop in R.
- casefold – Translate character to lower or upper case.
- cbind – Combine vectors, matrices and/or data frames by column.
- ceiling – Round numeric up to the next higher integer.
- charmatch – Return position of first match between two data objects.
- chartr – Translate characters of string to lower and/or upper case.
- colMeans – Compute the mean of each column of a numeric data frame, matrix or array.
- colMedians [robustbase] – Compute the median of each column of a numeric matrix.
- colnames – Retrieve or set the column names of a data frame or matrix.
- colSums – Compute the sum of each column of a numeric data frame, matrix or array.
- complete.cases – Return a logical vector that indicates which cases have no missing values.
- cumsum – Calculate the cumulative sum of the elements of a numeric vector.
- dbeta – Return corresponding value of beta density.
- dbern – Return corresponding value of bernoulli PDF.
- dbinom – Return corresponding value of binomial density.
- dcauchy – Return corresponding value of cauchy density.
- dchisq – Return corresponding value of chi-square PDF.
- deparse – Convert an expression to the character class.
- detach – Remove the attachment of a data.frame or unload a package.
- dexp – Return corresponding value of exponential density.
- df – Return corresponding value of F PDF.
- dgamma – Return corresponding value of gamma density.
- dgeom – Return corresponding value of geometric PDF.
- dhyper – Return corresponding value of hypergeometric PDF.
- diff – Compute difference between pairs of consecutive elements of a vector.
- difftime – Calculate the time difference of two date or time objects.
- dim – Return the dimension (e.g. the number of columns and rows) of a matrix, array or data frame.
- dir – Return a character vector of file and/or folder names within a directory.
- dlnorm – Return corresponding value of log normal PDF.
- dlogis – Return corresponding value of logistic PDF.
- dnbinom – Return corresponding value of negative binomial density.
- dnorm – Create standard normal distribution.
- download.file – Download file from internet.
- dpois – Return value of poisson density.
- droplevels – Remove unused levels of a factor.
- dsignrank – Return corresponding PDF value of wilcoxon signedank statistic.
- dt – Return corresponding value of Student t PDF.
- dtukey – Return corresponding value of studentized range PDF.
- dunif – Return corresponding value of uniform PDF.
- dweibull – Return corresponding value of weibull density.
- dwilcox – Return corresponding PDF value of wilcoxon rank sum statistic.
- ecdf – Compute the Empirical Cumulative Distribution Function (ECDF).
- eval – Evaluate an expression and return the result.
- exists – Check whether an object is defined in the R environment.
- expression – Create an R object of the expression class.
- find – Return location where objects of a given name can be found.
- floor – Round numeric down to the next lower integer.
- full_join [dplyr] – Full join two data frames.
- geometric.mean [psych] – Compute the geometric mean.
- get – Search and call a data object.
- get0 – Call an existing data object or return an alternative value.
- ggpairs [GGally] – Return a matrix of plots based on a given data set.
- gregexpr – Search for match of certain character pattern.
- grep – Search for match of certain character pattern and return indices.
- grepl – Search for match of certain character pattern and return logical.
- gsub – Replace all matches in character string.
- harmonic.mean [psych] – Compute the harmonic mean.
- inner_join [dplyr] – Inner join two data frames.
- IQR – Compute the Interquartile Range.
- is.na – Return a logical vector or matrix indicating which elements are missing.
- is.nan – Return a logical vector or matrix indicating which elements are not a number.
- is.null – Return a logical value indicating whether a data object is of the data class NULL.
- is.unsorted – Check whether an input is unsorted.
- jitter – Add noise to a numeric vector.
- julian – Return the number of days between two date objects.
- left_join [dplyr] – Left join two data frames.
- length – Return the length of data objects such as vectors or lists.
- load – Load RData workspace file into R.
- lowess – Compute the lowess smoother.
- match – Return position of first match between two data objects.
- max – Compute the maximum value of a vector or column.
- mad – Compute the median absolute deviation.
- mean – Compute the arithmetic mean.
- median – Compute the median.
- merge – Merge data frames.
- mget – Search and call several data objects.
- min – Compute the minimum value of a vector or column.
- Mode [DescTools] – Compute the mode.
- months – Return the corresponding month of a date.
- n.readLines [reader] – Skip ahead in a file and read text lines.
- na.omit – Remove incomplete cases of a data object.
- nchar – Return the number of elements (e.g. letters) of a character object.
- ncol – Return the number of columns of a matrix or data frame.
- next – Skip certain parts of for-loop in R.
- nrow – Return the number of rows of a matrix or data frame.
- order – Return position of each input element in ascending or descending order.
- outer – Apply a function to two arrays.
- packageVersion – Find out the currently loaded version of an R package.
- pairs – Return a plot matrix consisting of scatterplots for each variable-combination of a data frame.
- parse – Convert a character to the expression class.
- paste – Concatenate inputs to string.
- paste0 – Concatenate inputs to string with given separator.
- pbern – Return corresponding value of bernoulli CDF.
- pbeta – Return corresponding value of beta cumulative distribution function.
- pbinom – Return corresponding value of binomial cumulative distribution function.
- pcauchy – Return corresponding value of cauchy cumulative distribution function.
- pchisq – Return corresponding value of chi-square CDF.
- pexp – Return corresponding value of exponential cumulative distribution function.
- pf – Return corresponding value of F CDF.
- pgamma – Return corresponding value of gamma cumulative distribution function.
- pgeom – Return corresponding value of geometric CDF.
- phyper – Return corresponding value of hypergeometric CDF.
- plnorm – Return corresponding value of log normal CDF.
- plogis – Return corresponding value of logistic CDF.
- pmatch – Return position of first match between two data objects.
- pmax – Return the parallel maxima of two or more vectors.
- pmin – Return the parallel minima of two or more vectors.
- pnbinom – Return corresponding value of negative binomial cumulative distribution function.
- pnorm – Return value of distribution function.
- polygon – Draw a polygon to a plot.
- ppois – Return value of poisson cumulative distribution function.
- pretty – Compute a sequence of equally spaced round values.
- psignrank – Return corresponding CDF value of wilcoxon signedank statistic.
- pt – Return corresponding value of Student t CDF.
- ptukey – Return corresponding value of studentized range CDF.
- punif – Return corresponding value of uniform CDF.
- pweibull – Return corresponding value of weibull CDF.
- pwilcox – Return corresponding CDF value of wilcoxon rank sum statistic.
- qbern – Return corresponding value of bernoulli quantile function.
- qbeta – Return corresponding value of beta quantile function.
- qbinom – Return corresponding value of binomial quantile function.
- qcauchy – Return corresponding value of cauchy quantile function.
- qchisq – Return corresponding value of chi-square quantile function.
- qexp – Return corresponding value of exponential quantile function.
- qf – Return corresponding value of F quantile function.
- qgamma – Return corresponding value of gamma quantile function.
- qgeom – Return corresponding value of geometric quantile function.
- qhyper – Return corresponding value of hypergeometric quantile function.
- qlnorm – Return corresponding value of log normal quantile function.
- qlogis – Return corresponding value of logistic quantile function.
- qnbinom – Return corresponding value of negative binomial quantile function.
- qnorm – Return value of quantile function.
- qpois – Return value of poisson quantile function.
- qsignrank – Return corresponding quantile function value of wilcoxon signedank statistic.
- qt – Return corresponding value of Student t quantile function.
- qtukey – Return corresponding value of studentized range quantile function.
- quantile – Compute sample quantiles.
- quarters – Return the corresponding quarter of a date.
- qunif – Return corresponding value of uniform quantile function.
- qweibull – Return corresponding value of weibull quantile function.
- qwilcox – Return corresponding quantile function value of wilcoxon rank sum statistic.
- rank – Return ranking position of input.
- rbern – Return bernoulli distributed random number.
- rbeta – Draw random number from beta density.
- rbind – Combine vectors, matrices and/or data frames by row.
- rbind.fill [plyr] – Row-bind matrices or data frames with different columns.
- rbinom – Draw random number from binomial density.
- rcauchy – Draw random number from cauchy density.
- rchisq – Return chi-square distributed random number.
- read_excel [readxl Package] – Read Excel File in R.
- read.xlsx [xlsx Package] – Read Excel File in R.
- read.xlsx [openxlsx Package] – Read Excel File in R.
- readline – Interactively read a line from the terminal.
- readLines – Read text lines from an input file.
- readRDS – Load RData workspace file into R.
- regexpr – Search for match of certain character pattern.
- regexec – Search for match of certain character pattern.
- return – Return output of user-defined R function.
- rev – Return a reversed version of vectors or other data objects.
- rexp – Draw random number from exponential density.
- rf – Return F distributed random number.
- rgamma – Draw random number from gamma density.
- rgeom – Return geometrically distributed random number.
- rhyper – Return hypergeometrically distributed random number.
- right_join [dplyr] – Right join two data frames.
- rlnorm – Return log normally distributed random number.
- rlogis – Return logistically distributed random number.
- rnbinom – Draw random number from negative binomial density.
- rnorm – Draw normally distributed random number.
- round – Round numeric to specified number of decimal places.
- rowMeans – Compute the mean of each row of a numeric data frame, matrix or array.
- rowMedians [robustbase] – Compute the median of each row of a numeric matrix.
- rowSums – Compute the sum of each row of a numeric data frame, matrix or array.
- rpois – Draw random value of poisson density.
- rsignrank – Return random number according to wilcoxon signedank statistic.
- rt – Return Student t distributed random number.
- rtukey – Return studentized range distributed random number.
- runif – Return uniformly distributed random number.
- rweibull – Draw random value of weibull density.
- rwilcox – Return random number according to wilcoxon rank sum statistic.
- save – Save R data objects as RData workspace file.
- save.image – Save global R environment as RData workspace file.
- saveRDS – Save single R data object as RData workspace file.
- scan – Read data into vector or list from file or R console.
- sd – Compute standard deviation.
- segments – Draw a line segment between two pairs of points.
- semi_join [dplyr] – Semi join two data frames.
- setdiff – Identify which elements of a data object X are not existent in a data object Y.
- setNames [stats] – Set names of a data object and return the object.
- setnames [data.table] – Change names of a data.frame or data.table by reference.
- signif – Round numeric to specified number of digits.
- sink – Export R output to external file.
- sort – Return input in ascending or descending order.
- sort.int – Return input in ascending or descending order.
- sort.list – Return position of each element of a single input.
- sprintf – Return character containing a formatted combination of input values.
- sqrt – Compute the square root of a numeric data object.
- std.error [plotrix] – Compute standard error in R.
- str_c [stringr] – Combine several inputs into a single character vector.
- str_sub [stringr] – Extract or replace substring from character string.
- strftime – Convert time objects to characters.
- strptime – Convert characters to time objects.
- structure – Set additional attributes of a data object.
- sub – Replace first match in character string.
- substr – Extract or replace a substring in a character vector.
- substring – Extract or replace a substring in a character vector.
- sweep – Apply an operation (e.g. + or -) to a matrix by row or column.
- tolower – Translate character to lower case.
- toupper – Translate character to upper case.
- transform – Modify data frames easily.
- trimws – Trim Leading and Trailing Whitespace.
- trunc – Cut off decimal places of a numeric input.
- type.convert – Convert data object to appropriate class.
- union – Return values that appear in at least one of two data objects.
- unlist – Convert a list to a single vector.
- var – Compute sample variance.
- weekdays – Return the corresponding weekday of a date.
- weighted.mean – Compute the weighted arithmetic mean.
- weightedMean [matrixStats] – Compute the weighted arithmetic mean.
- with – Evaluates expression in environment constructed based on data frame.
- within – Evaluates expression in environment and modify data frame.
- write.xlsx [xlsx] – Export data frame from R to Excel workbook.
- wt.mean [SDMTools] – Compute the weighted arithmetic mean.
- xtfrm – Produce numeric vector which sorts in same order as input.

## Basic R Functions – Video Tutorial for the Most Common Commands

Are you looking for an overview of the most common R functions? Have a look at the following Video of the UTSSC YouTube channel. In the video, the speaker gives an introduction to a list of some basic R commands.