Introduction to R for Postdocs
Date: March 11-12 & 18-19, 2019
Location: TBD
Instructors: Donna Wrublewski, Gail Clement, Tom Morrell
Helpers: Peter Collopy
Brief Syllabus:
The lessons will be based on the
Data Analysis and Visualization in R for Ecologists
Data Carpentry lesson, if you would like to get a preview of the content.
Please note that this class assumes no prior knowledge of, or experience with, R or RStudio. If you are not sure if this
class will be appropriate for you, please look over the lesson content above, or email the Instructors.
Day 1 (March 11, 9am - 12pm)
- Introduction to R and RStudio - View Online Lesson
- Working with R Projects
- Understanding Data Types and Working with Vectors View Online Lesson
- R Markdown Notebooks Download Lesson
Cheat Sheets:
RStudio
Base R
Day 2 (March 12, 9am - 12pm)
- Working with Data Frames
- Working with Factors
- Formatting Dates
Cheat Sheets:
Dates and Times - the lubridate package
Day 3 (March 18, 9am - 12pm)
- The Tidyverse - tidyr and dplyr
- Plotting with ggplot2
Cheat Sheets:
Tidyverse for Beginners
Data Visualization with ggplot2
Day 4 (March 19, 9am - 12pm)
- Reproducible Reporting and Interactive Publishing
Links to Cheat Sheets - coming soon!
Required Computer Setup
The Carpentries’ teaching is hands-on, so participants are encouraged to use
their own computers to insure the proper setup of tools for an efficient
workflow. These lessons assume no prior knowledge of the skills or tools, but
working through this lesson requires working copies of the software described
below. To most effectively use these materials, please make sure to install
everything before working through this lesson.
R and RStudio are separate downloads and installations. R is the
underlying statistical computing environment. RStudio is a graphical integrated
development environment (IDE) that makes using R easier and more interactive.
You need to install R before you install RStudio.
If you don’t have R and RStudio installed:
Download R Version 3.5.2 from the CRAN website for your operating system:
- Windows
- Mac OS
- Linux (Information provided to get the most recent version of R for common distributions.)
- Note that 3.5.3 is due to be released on
March 11 - please do not upgrade during the workshop unless you have a pressing
need to do so.
Open the .exe
(Windows) or .pkg
(Mac) just downloaded to install R. For Linux, follow the
directions given on the website for your particular distribution.
- If you are a Mac user, it is also a good idea to install XQuartz (needed by some R packages).
Go to the RStudio download page and
download the latest version of RStudio for your platform (1.1.463 or later).
Open the downloaded file and install RStudio.
Once it’s installed, open RStudio to make sure it works and you don’t get any error messages, and the Console window shows the
correct version of R installed (should be 3.5.2).
If you already have R and RStudio installed:
Open RStudio, and click on “Help” > “Check for updates”. If a new version is
available, quit RStudio, and download the latest version of RStudio from the
RStudio download page.
To check which version of R you are using, start RStudio and check the Console window. The first line that appears in the Console indicates the version of R that is running. Alternatively, you can type sessionInfo()
, which will also display which version of R is running.
If you are not running 3.5.2, please see Steps 1 and 2 above under “If you don’t have R and RStudio installed”.
- You can check here for more information on how to remove old versions from your system if you wish to do so.
Required Online Accounts
You will need a GitHub account for the final day to publish your notebook. Please create an account in advance before Day 4.
Required Files
- Create a folder somewhere on your computer to store files associated with this workshop.
- Please download the following .zip file into the folder to you created in Step 1: https://github.com/caltechlibrary/R-Carpentry/blob/master/2019-03/user_downloads/carpentry-workshop.zip
- Open/extract the .zip file you downloaded in Step 2.
- You should now have, within your folder, a new folder entitled carpentry-workshop, and the following should be in that folder:
- two files for 01-getting-started-notebook-version, a .Rmd file and a .nb.html file
- a data/ folder that contains some .csv files
- an empty data_output/ folder
- an empty fig_output/ folder
- an img/ folder, containing images needed by the .Rmd files
- two .R script files, install_packages.R and load_packages.R
- Part 3 of the Day 1 lesson, Understanding Data Types and Working with Vectors, can be downloaded here.
- Part 4 of the Day 1 lesson, R Markdown Notebooks, can be downloaded here.
- The Day 2 lesson, Starting With Data, can be downloaded here. Please note - there are three files in this zip. Please put the two 04 files (the .Rmd and the .nb.html) in the main carpentry-workshop/ directory, with the other Rmd and nb.html files. Please put the file that is in the img/ folder from the downloaded zip (data-frame.svg) into the img/ folder under carpentry-workshop.
- The Day 3 lesson, The Tidyverse, can be downloaded here. Please note - there are four files in this zip. Please put the two 05 files (the .Rmd and the .nb.html) in the main carpentry-workshop/ directory, with the other Rmd and nb.html files. Please put the two files in the img/ folder from the downloaded zip into the img/ folder under carpentry-workshop.
- The Day 3 lesson for ggplot is here. Download the zip file, extract it, and move both 06 files into the main carpentry-workshop/ directory.
- The Day 4 lesson on making a report can be downloaded
here.
Download the zip file, extract it, and put it someplace you can find it like
your desktop.
Resources
The Caltech Library has many books and ebooks on R, including many on the Safari platform.
Page last updated 2019-03-19T17:09:16Z