/R-learning-resources

This is a collection of resources that I have found helpful in learning R

R learning resources

This is a collection of resources that I have found helpful in learning R.

getting started

importing data

  • readr - read in rectangular formats (e.g., csv)
  • readxl - read in Excel formats
  • haven - import and export SPSS, STATA, and SAS

creating data frames

  • tribble - create tibbles with an easier to read row-by-row layout

combining multiple data frames

  • dplyr's join functions - includes for example left_join(), right_join(), inner_join(), full_join(), bind_rows(), bind_cols()

reshaping and manipulating data frames

  • dplyr - manipulate data (e.g., mutate, select, filter, summarize)
  • tidyr - tidy messy data, reshaping data (e.g., pivoting data from wide to long or long to wide)
  • tibble - includes for example add_row() and add_column()
  • stringr - tools for working with character strings
  • lubridate - tools for working with dates and times

data cleaning

  • gsub - replace multiple occurrences of strings
  • janitor - clean data (e.g., clean variable names)

data frame exploration

  • DataExplorer - has a great create_report() function; can also plot missing values with plot_missing()
  • glimpse - take a glimpse at data frame
  • skimr - quickly skim descriptive statistics of data
  • lares - useful functions to learn about a data frame include freqs(), missingness(), and df_str()

descriptives

  • descriptive statistics - example of examining data numerically and visually
  • summary - provides descriptives of data with summary() function
  • hmisc - hmisc package has the describe() function to get statistical descriptions
  • psych - psych package has the describe() function

missing data

  • VIM - visualize missing data
  • visdat - helps you visualise a dataframe, including missing data
  • nanier - explore missing data structures
  • with tidyverse - guide to visualizing missing data using ggplot2, dplyr, tidyr

longitudinal data

  • brolgar
  • overviewR - examines data and sample coverage across time and conditions

tables

  • apaTables - export APA formatted tables from R to word
  • broom - turns messy output of built-in functions in R (e.g., lm, t.test) into tidy tibbles
  • dt - render data objects in R as HTML tables
  • gt - create customized tables
  • kable - very simple table generator for strictly rectangular data (e.g., matrices, data frames)
  • pander - improve aesthetics of R outputs
  • stargazer

correlations

regression

  • dummies - convert categorical data to dummy variables
  • mctest - test for multicollinearity

country data

  • countrycode - use to standardize country names; contains 40 different coding themes

plots, in general

themes

color

color palettes

highlighting

fonts

  • extrafont - using fonts other than PostScript
  • showtext - alternative to extrafont; can use google fonts

combining multiple plots

  • patchwork - combine multiple plots in same visualization
  • cowplot - arrange plots in grid
  • gridExtra - lay out multiple plots

animating plots

interactive web plots

saving plots

  • ggsave - saving a ggplot
  • cairo - using cairo package to save high quality images

data visualization

#TidyTuesday

data visualization catalogues


R markdown and reporting


R tutorials


collection of online books and courses


R for psychological research

  • psych - descriptive and statistical analysis
  • lavaan - latent variable analysis (e.g., SEM)
  • likert - analyze and visualize likert type items
  • lme4 - mixed-effects models
  • GLM in R
  • papaja - use R markdown to create APA journal articles
  • stats - regression analysis, t tests and much more

Datasets for practice


list of lists of useful R resources