Function | Package | Workflow | Description |
---|---|---|---|
getwd() |
{base} | Basics | get your working directory |
setwd() |
{base} | Basics | set your working directory |
install.packages() |
{base} | Basics | install R package(s) |
library() |
{base} | Basics | load an R package |
help() |
{base} | Basics | get help on a function |
c() |
{base} | Basics | typically used to combines values into a vector |
data.frame() |
{base} | Basics | create a data frame |
head() |
{base} | Basics | print the first 6 rows |
tail() |
{base} | Basics | print the last 6 rows |
read_csv() |
{readr} | Import | read a .csv file |
read_excel() |
{readxl} | Import | read a .xls or .xlsx file |
read_sav() |
{haven} | Import | read a .sav file |
read_dta() |
{haven} | Import | read a .dta file |
read_html() |
{rvest} | Import | download and parse an html web page |
html_nodes() |
{rvest} | Import | find html nodes that match a CSS selector |
html_text() |
{rvest} | Import | extract text from html nodes |
gather() |
{tidyr} | Tidy | convert dataframe from wide to long format |
spread() |
{tidyr} | Tidy | convert dataframe from long to wide format |
separate() |
{tidyr} | Tidy | split variable into separate variables |
unite() |
{tidyr} | Tidy | combine variables into a single variable |
unnest_tokens() |
{tidytext} | Tidy | unnests values in text column into a word column |
get_sentiments() |
{tidytext} | Tidy | retrieves sentiment lexicons |
select() |
{dplyr} | Transform | pick variables |
pull() |
{dplyr} | Transform | pick variable and return a vector of values |
slice() |
{dplyr} | Transform | pick observations |
filter() |
{dplyr} | Transform | subset observations |
arrange() |
{dplyr} | Transform | reorder observations |
mutate() |
{dplyr} | Transform | add new variables |
mean() |
{base} | Transform | calculate arithmetic mean |
median() |
{base} | Transform | calculate the median |
group_by() |
{dplyr} | Transform | group observations with same values |
count() |
{dplyr} | Transform | calculate frequencies |
summarise() |
{dplyr} | Transform | return summary statistics |
left_join() |
{dplyr} | Transform | merge data frames together |
right_join() |
{dplyr} | Transform | merge data frames together |
hour() |
{lubridate} | Transform | extract hour |
month() |
{lubridate} | Transform | extract month |
wday() |
{lubridate} | Transform | extract week day |
ggplot() |
{ggplot2} | Visualise | call a ggplot object |
geom_point() |
{ggplot2} | Visualise | plot observations as points |
geom_line() |
{ggplot2} | Visualise | connect observation with a line |
facet_wrap() |
{ggplot2} | Visualise | facet your output by variable |
coord_flip() |
{ggplot2} | Visualise | flip the plot |
scale_colour_brewer() |
{RColorBrewer} | Visualise | use palettes from colorbrewer2.org |
ggplotly() |
{plotly} | Visualise | convert ggplot2 to plotly |
render() |
{rmarkdown} | Report | render an RMarkdown document |
© 2018 Réka Solymosi, Henry Partridge and Sam Langton. Some rights reserved.