# **A gentle crash course in R using tidyverse**
## Loek Brinkman & Nick Michalak
![](https://www.improvingpsych.org/SIPS2018/wp-content/uploads/2018/01/Society-for-the-Improvement-of-Psychological-Science3-300x105.png)
![](https://lsru.github.io/tv_course/img/01_tidyverse_data_science.png)
# **Introduction**
> - What is R and why use it in your research?
> - R Studio environment
> - Programming basics
> - Installing the tidyverse
# **Data visualization**
> - ggplot2 and the grammar of graphics
> - demonstrations
> - exercises
# **Data reading and "wrangling"**
> - filtering datasets
> - selecting variables
> - creating new variables
> - custom data summaries
> - grouping data transformations and summaries
# **Data summarizing and modeling**
> - descriptive statistics
> - t-tests, ANOVAs, and linear regression
> - correlations
> - if there's time ...
> + linear mixed effects models
> + structural equal models
> + exploratory factor analysis
# **Wrap-up and resources**
# **R resources**
## **websites**
> - [**Quick-R**](http://www.statmethods.net/) a roadmap to the language and the code necessary to get started quickly (i.e. tutorials)
> - [**R Studio Cheat Sheets**](https://www.rstudio.com/resources/cheatsheets/) just like it reads, these are cheat sheets for "favorite" R packages and more (e.g. dplyr, ggplot2, base, R Markdown, regular expressions)
> - [**UCLA Institute for Digital Research and Education: R**](http://stats.idre.ucla.edu/r/) statistics and programming tutorials for R, among other helpful related resources
> - [**The Personality Project: Using R for psychological research**](https://www.personality-project.org/r/r.guide.html) seemingly endless tutorials and explainers about R programming for (personality-themed) psychology research; also, some tutorials cover the psych package, which is written by Michigan Psychology alumni, William Revelle (1973)
> - [**Richard Gonzalez's Advanced Statistical Methods Course Notes**](http://www-personal.umich.edu/~gonzo/coursenotes/) Nick's regression bible, complete with SPSS and R code for common procedures + detailed notes
> - [**Doug Bonett's Quantitative Data Analysis Course R Functions**](https://people.ucsc.edu/~dgbonett/docs/psyc204/204RFunctions.docx) includes functions for testing linear contrasts (standardized and unstandardized) that don't assume equal variances
> - [**tidyverse: ggplot2**](http://ggplot2.tidyverse.org/index.html) ggplot2 bible (also check out the rest of the tidyverse website)
> - [**lavaan: latent variable analysis**](http://lavaan.ugent.be/) overview and tutorials for the best sem package (IMO) in R (disclaimer: no support for discrete latent variables, aka mixture modeling, latent class analysis)
> - [**RExRepos: R code examples for a number of common data analysis tasks**](http://www.uni-kiel.de/psychologie/rexrepos/index.html) just like it reads, how-to guide for common procedures
> - [**R Base Graphics: An Idiot's Guide**](http://rpubs.com/SusanEJohnston/7953) if you want to plot with Base graphics like an R hipster?a hipstR, if you will?here's a jumping off point
> - [**{ swirl }: Learn R, in R**](http://swirlstats.com/) _"swirl teaches you R programming and data science interactively, at your own pace, and right in the R console!"_
> - [**A language, not a letter: Learning statistics in R**](http://ademos.people.uic.edu/index.html) _"This online collection of tutorials was created by graduate students in psychology as a resource for other experimental psychologists interested in using R for statistical analyses and graphics. Each chapter was created to provide an overview of how to code a particular topic in the R language."_
> - [**STAT 545 @ UBC: Data wrangling, exploration, and analysis with R**](http://stat545.com/index.html) _"Learn how to explore, groom, visualize, and analyze data and make all of that reproducible, reusable, and shareable using R"_
> - [**designingexperiments.com**](https://designingexperiments.com/) site accompanies Designing Experiments and Analyzing Data: A Model Comparison Perspective (3rd edition; Maxwell, Delaney, & Kelley, 2018). It's full of modeling examples for R, but it also includes some extremely useful website applications for power analyses for all sorts of common designs
## **texts**
> - Beaujean, A. A. (2014). [**Latent variable modeling using R: A step-by-step guide**](https://blogs.baylor.edu/rlatentvariable/). New York, NY: Routledge.
> - Field, A., Miles., J., & Field, Z. (2012). [**Discovering statistics using R**](https://us.sagepub.com/en-us/nam/discovering-statistics-using-r/book236067%20#resources). London: SAGE Publications.
> - Gelman, A., & Hill, J. (2007). [**Data analysis using regression and multilevel/hierarchical models**](http://www.stat.columbia.edu/~gelman/arm/). New York, NY: Cambridge University Press.
> - Ismay, C. & Kim, A.Y. (2017). [**ModernDive: An Introduction to Statistical and Data Sciences via R.**](https://ismayc.github.io/moderndiver-book/)
> - Navarro, D. (2015). [**Learning Statistics with R**](https://health.adelaide.edu.au/psychology/ccs/teaching/lsr/). Raleigh, North Carolina: Lulu Press, Inc.
> - Maxwell, Delaney, & Kelley, (2018). [**Designing experiments and analyzing data: A model comparison perspective. (3rd ed.)**](https://www.routledge.com/Designing-Experiments-and-Analyzing-Data-A-Model-Comparison-Perspective/Maxwell-Delaney-Kelley/p/book/9781138892286). Routledge.
> - Wickham, H. (2015). [**Advanced R**](http://adv-r.had.co.nz/). Boca Raton, FL: CRC Press.
> - Wickham, H. (2016). [**ggplot2: Elegant graphics for data analysis**](http://ggplot2.org/book/). New York, NY: Springer.
> - Zuur, A. F., Ieno, E. N., Walker, N. J., Saveliev, A. A., & Smith, G. M. (2009). [**Mixed effects models and extensions in ecology with R**](https://www.amazon.com/Effects-Extensions-Ecology-Statistics-Biology/dp/0387874577). New York, NY: Springer.
# **Acknowledgements**
> - Ron Dotsch (adapted course slides)
> - SIPS organizers
> - R for Data Science (workshop modeled off book)