Learners' Reference
Last updated on 2026-04-23 | Edit this page
Cheat sheet of functions used in the workshops. This will be populated as we work through the workshops.
Workshop – Introduction to R
-
install.packages()# installRpackages to your computer
Workshop – Introduction to
R Packages,Markdown and
Notebooks
-
library()# loadRpackages in eachRsession
Workshop – Starting with Data
-
<-# assignment arrow assigns inputs to a named object -
read_csv()# import data in .csvfiles intoR(readr, part oftidyverse) -
class()# check the class of an object -
dim()# returns a vector with the dimensions of the object -
nrow()# returns the number of rows -
ncol()# returns the number of columns -
head()# shows the first 6 rows -
tail()# shows the last 6 rows -
names()# returns the column names -
str()# structure of the object and information about the class, length and content of each column -
summary()# summary statistics for each column -
glimpse()# returns the number of columns and rows of a tibble, the names and class of each column, and previews as many values will fit on the screen (dplyr, part oftidyverse) -
c()# combine values into a vector or list -
factor()# encode a vector as a factor -
levels(0# provides access to the levels attribute of a variable -
nlevels()# provides number of levels of a factor -
as.character()# create or coerce objects of type character -
as.numeric()# create or coerce objects of type numeric -
as.factor()# encode a vector as a factor -
plot()# create a generic X-Y plot -
day()# extract day value from a date (lubridate, part oftidyverse) -
month()# extract month value from a date (lubridate, part oftidyverse) -
year()# extract year value from a date (lubridate, part oftidyverse) -
day()# extract day value from a date (lubridate, part oftidyverse) -
as_date()# convert an object to a date or date-time (lubridate, part oftidyverse) -
mdy(),ymd(),dmy()# parse dates (lubridate, part oftidyverse)
Workshop – Manipulating Data with dplyr and
tidyr
-
select()# subset columns (dplyr, part oftidyverse) -
filter()# subset rows on conditions (dplyr, part oftidyverse) -
mutate()# create new columns by using information from other columns (dplyr, part oftidyverse) -
group_by()andsummarize()# create summary statistics on grouped data (dplyr, part oftidyverse) -
arrange()# sort results (dplyr, part oftidyverse) -
count()# count discrete values (dplyr, part oftidyverse) -
%>%# a pipe, take the output of one function and send it directly to the next (tidyverse) -
filter()# filter rows (dplyr, part oftidyverse) -
select()# seclect columns (dplyr, part oftidyverse) -
mutate()# create, modify, and delete columns (dplyr, part oftidyverse) -
distinct()# keep distinct/unique rows (dplyr, part oftidyverse) -
sample_n()# sample n rows from a table (dplyr, part oftidyverse) -
pivot_wider()# pivot data from long to wide (tidyr, part oftidyverse) -
pivot_longer()# pivot data from wide to long (tidyr, part oftidyverse) -
separate_longer_delim()# split a string into rows (tidyr, part oftidyverse) -
replace_na()# replace NAs with specified values (tidyr, part oftidyverse) -
write_csv()# export data in .csvformat (readr, part oftidyverse)