Slides

Data Analysis with R: Tips for Making Your R Life Better

Below are some of the resources mentioned in the slides. See the slides themselves for more explanation and examples!

Resources from the Slides

Getting R

Go to slide

The main R website is www.r-project.org.

Download and install R for your operating system at CRAN:
cloud.r-project.org

I can help on Windows (because I have to) and Linux (because I love to).
On OS X/macOS, you’re on your own. Try the FAQ or these posts by Bob Rudis (here and here).

Tip #1: Use RStudio

Go to slide

The main RStudio website is www.rstudio.com.

Download and install RStudio for your operating system here:
https://www.rstudio.com/products/rstudio/download/

Tip #2: Don’t Type at the Console: Use R Scripts

Go to slide

Follow Hadley Wickham’s code style guidelines.

Tip #2.5: Use RStudio Projects

Go to slide

R and RStudio Basics: Resources

Go to slide

Tip #3: Use Awesome R Packages!

Go to slide

install.packages(c("tidyverse", "rmarkdown"))

Tip #4: Use ggplot2 for Graphics

Go to slide

ggplot2 Resources

Go to slide

Tip #5: Use Tidy Data

Go to slide

Tidy data means:

  1. Each variable must have its own column.
  2. Each observation must have its own row.
  3. Each value must have its own cell.

If you do not have tidy data, the tidyr package can be used to tidy your data.

Tip #6: Use dplyr

Go to slide

Tidy Data and dplyr Resources

Go to slide

Tidy Data and Lord of the Rings by Jenny Bryan

R for Data Science: Tidy Data, dplyr

Official Introduction to dplyr

STAT 545 Basic care and feeding of data in R

STAT 545 Introduction to dplyr

STAT 545 dplyr functions for a single dataset

Video Introduction to the dplyr R package by Roger Peng

Tip #6.5: Use Pipes

Go to slide

Tip #7: Use readr for Data Import

Go to slide

See Data Import in R for Data Science and Getting data in and out of R from the STAT 545 site.

Tip #8: Update R

Go to slide

WARNING: updates to packages may break your scripts. I’d highly recommend avoiding updates during a project (unless you have time to fix anything that breaks).

Tip #9: How to Get Help

Go to slide

Google is your friend!

Often, literally typing your question (with “R” in it) or pasting an error message into Google will give you helpful results. There are tons of R blogs and other resources readily available.

There is an R Help e-mail list, the text of which can be found online. Only ask for help on this list if you’ve tried everything you can possibly think of to find the answer yourself, memorized the Posting Guide, and followed the Posting Guide meticulously. And don’t be surprised if you get a rude answer.

You can try rseek.org to search Google for R-specific results.

Lots of good answers are found at StackExchange / Stack Overflow.

Statistics questions are answered at Cross Validated.

Ask someone you know in person! I generally would love to help you get better at R and am happy to answer questions.

Bonus Tip: Use R Markdown

Go to slide

rmarkdown.rstudio.com