R Functions List (+ Examples) | All Basic Commands of the R Programming Language
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
- all – Check whether all values of a logical vector are TRUE.
- any – Check whether any values of a logical vector are TRUE.
- 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.
- cbind – Combine vectors, matrices and/or data frames by column.
- 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.
- 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.
- droplevels – Remove unused levels of a factor.
- ggpairs [GGally] – Return a matrix of plots based on a given data set.
- is.na – Return a logical vector or matrix indicating which elements are missing.
- is.null – Return a logical value indicating whether a data object is of the data class NULL.
- jitter – Add noise to a numeric vector.
- length – Return the length of data objects such as vectors or lists.
- lowess – Compute the lowess smoother.
- max – Compute the maximum value of a vector or column.
- min – Compute the minimum value of a vector or column.
- 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.
- nrow – Return the number of rows of a matrix or data frame.
- outer – Apply a function to two arrays.
- pairs – Return a plot matrix consisting of scatterplots for each variable-combination of a data frame.
- pmax – Return the parallel maxima of two or more vectors.
- pmin – Return the parallel minima of two or more vectors.
- polygon – Draw a polygon to a plot.
- pretty – Compute a sequence of equally spaced round values.
- rbind – Combine vectors, matrices and/or data frames by row.
- rbind.fill [plyr] – Row-bind matrices or data frames with different columns.
- readline – Interactively read a line from the terminal.
- readLines – Read text lines from an input file.
- rev – Return a reversed version of vectors or other data objects.
- 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.
- segments – Draw a line segment between two pairs of points.
- 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.
- strftime – Convert time objects to characters.
- strptime – Convert characters to time objects.
- structure – Set additional attributes of a data object.
- 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.
- union – Return values that appear in at least one of two data objects.
- unlist – Convert a list to a single vector.
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.