Appendix A — Useful functions

A.1 Importing data

  • read.csv()
  • read.csv2()
  • readr::read_csv()
  • readr::read_csv2()
  • readr::read_delim()
  • readr::read_rds()
  • haven::read_sav()
  • haven::read_dta()
  • haven::read_delim()
  • readxl::read_excel()
  • openxlsx::read.xlsx()

A.2 Getting an idea of the data

  • nrow()
  • ncol()
  • summary()
  • dplyr::glimpse()

A.3 Describing data

  • summary()
  • table()
  • janitor::tabyl()
  • mean()
  • median()
  • sd()

A.4 Manipulate data

  • dplyr::count()
  • dplyr::select()
  • dplyr::filter()
  • dplyr::arrange()
  • dplyr::mutate()
  • dplyr::group_by()
  • dplyr::summarise()
  • dplyr::rename()
  • dplyr::rename()
  • dplyr::slice_min()
  • dplyr::slice_max()

A.5 Clean and recode

  • tidyr::pivot_longer()
  • tidyr::pivot_wider()

A.6 Testing bivariate relationships

  • t.test()
  • cor()

A.7 Modelling

  • lm()
  • broom::tidy()
  • broom::glance()
  • broom::augment()