Reference
Last updated on 2026-07-28 | Edit this page
Other Resources and Further Learning
- R for Data Science (2e) - free online book
- RStudio IDE cheatsheet
- dplyr documentation and cheatsheet
- tidyr documentation and cheatsheet
- ggplot2 documentation and cheatsheet
- lubridate documentation
- tidyverse style guide
- R documentation search
- Stack
Overflow
rtag - RStudio Community forum
- CRAN Task Views (browse packages by topic)
Glossary
- argument
- A value passed to a function when it is called, used to control what the function does. Some arguments are required; others have default values and are called options.
- assignment operator
-
The
<-symbol used in R to assign a value to an object, e.g.weight_kg <- 55. Can be read as “55 goes intoweight_kg”. The=sign can also perform assignment but is conventionally reserved for setting function arguments. - class
-
The type of an R object
(e.g.
numeric,character,data.frame,factor), which determines how functions handle it. Found using theclass()function. - coercion
- The automatic conversion of values from one class to another when they are combined, for example when mixed data types are placed in a single vector. Coercion follows a hierarchy: logical → integer → numeric → character.
- comment
-
A remark in a script intended to help human readers understand the code,
but ignored when the code runs. Comments in R start with a
#character and run to the end of the line. - console
-
The pane in RStudio where R commands can be typed and are executed
immediately, and where results are displayed. Indicated by a
>prompt when ready for input, or a+prompt when an incomplete command is still being entered. - coordinates
-
In the context of a data frame, the row and column position (e.g.
surveys[1, 6]) used with square-bracket indexing to extract specific data. Row numbers are specified first, followed by column numbers. - data frame
-
A tabular data structure in which columns
are vectors of equal length, and each column holds
a single type of data. The standard structure for tabular data in R,
most commonly created by
read.csv()orread.table(). - data structure
- A way of organising and storing data in R. Common data structures include vectors, lists, matrices, data frames, factors, and arrays.
- factor
- A data structure used to represent categorical data. Factors are stored internally as integers associated with text levels, and can be ordered or unordered.
- filtering
-
Subsetting rows of a data frame based on a logical condition, most
commonly with the
dplyrfunctionfilter(), e.g.filter(surveys, year == 1995). - function
-
A named, reusable set of instructions that performs a task, usually
taking one or more arguments as input and
returning a value as output. Running a function is
called calling it, e.g.
sqrt(10). - geom
-
Short for “geometric object”; a
ggplot2layer function that determines how data is visually represented in a plot, such asgeom_point()for scatter plots,geom_boxplot()for boxplots, orgeom_line()for line plots. - aesthetic mapping
-
In
ggplot2, the association between variables in a dataset and visual properties of a plot (position, colour, size, shape), set using theaes()function, e.g.aes(x = weight, y = hindfoot_length). - faceting
-
A
ggplot2technique that splits a single plot into multiple small panels based on the values of one or more variables, usingfacet_wrap()orfacet_grid(). - level
-
One of a pre-defined set of possible values that a factor can take. By default, R sorts levels
alphabetically. Found using the
levels()function. - library
-
A collection of R functions, data, and
documentation bundled together as a package; also
the name of the function (
library()) used to load an installed package into an R session. - missing value
-
A value that is absent from a dataset, represented in R by
NA. Many functions returnNAif any input contains missing values unless told to ignore them, typically with the argumentna.rm = TRUE. - object
- A named “container” in R that stores a value, such as a number, character string, vector, or data frame. Also referred to as a variable. Created using the assignment operator.
- option
-
An argument to a function that has a default
value, typically used to alter how the function behaves
(e.g.
digitsinround()). Can be left out to use the default, or specified to override it. - package
-
A collection of R functions, data, and documentation that extends R’s
built-in capabilities. Must be installed once with
install.packages()and loaded in each session withlibrary(). - pipe
-
An operator that passes the result of one expression as the first
argument to the next, allowing multiple operations to be chained
together in a readable sequence. Written as
|>in base R (or%>%from themagrittr/tidyversepackages). - pivoting
-
Reshaping a data frame between “wide” and “long” formats using
tidyrfunctions:pivot_longer()converts columns into rows (wide to long), andpivot_wider()converts rows into columns (long to wide). - reproducibility
- The ability for someone else, including your future self, to obtain the same results from the same dataset using the same documented analysis steps, typically achieved by working from saved scripts rather than manual, undocumented actions.
- script
- A plain text file containing a saved sequence of R commands, which can be run and re-run to reproduce an analysis. Written and edited in the RStudio Source pane.
- split-apply-combine
-
A data analysis strategy in which data is split into groups (using
group_by()), a function is applied to each group (e.g. withsummarize()), and the results are combined into a single output. - subsetting
-
Extracting specific elements from a vector or data frame, using numeric indices, logical
conditions, or column/row names inside square brackets, or with
dplyrfunctions likeselect()andfilter(). - tibble
-
The
tidyverseversion of a data frame (classtbl_df), with slightly different default printing and behaviour, typically created byread_csv()rather thanread.csv(). - value
- A piece of information stored and retrieved by an object, such as a number, a character string, or a collection of these, such as a vector.
- vector
-
The most basic data structure in R: an
ordered collection of values of the same class,
created with the
c()function. - working directory
-
The folder R uses as the default location to look for and save files.
Best managed using an RStudio Project, and checked with
getwd(). Scripts should not hard-code changes to it withsetwd(), since this will not work on someone else’s computer.