In this two-part exercise, I expect to present enough information to get you started on your way to learning R. Because each class period is a 1 hour 15 minutes, my goal is to introduce you to R and then show you an example of how to analyze our data in R, emphasizing problem solving and troubleshooting. By the end of the exercise you should have just enough background to be able to learn more. If you already know some R, please assist people sitting next to you as questions or issues arise.
Again, because we only have two class periods, I ask that you come prepared with a laptop that has the most recent versions of R and RStudio installed. Please note that a new version of RStudio was released on October 9th, 2017, so make sure you have the most recent version before the workshop. Due to time constraints, I cannot provide installation assistance during class. Those who are not prepared for the class may be asked work with another participant to follow along.
Even if you already have R installed on your system, you really should make sure its up to date. This ensures that there are no problems due to outdated software. For more details about installing R, RStudio, and keeping everything up to date, UBC’s STAT545 page is an excellent resource.
Once you have installed R, we should verify that you have the correct version.
Enter the following in the R console after the >
R.version.string == "R version 3.4.4 (2018-03-15)"
Make sure the result is [1] TRUE
(If the result is [1] FALSE
, please quit R and try the installation again)
The exercise materials is a zip file that contains a folder called IntroR-for-PLPT802
with the folowing structure:
.
├── IntroR-for-PLPT802.Rproj
├── Part1-Introduction.R
I am providing the R scripts for the exercise. We will be live-coding some scripts, and I encourage you to follow along by creating your own R scripts so that you can get comfortable typing these commands. For those who feel the pace is too fast, or are unable to type the commands, feel free to execute the code in these scripts to follow along.