R Settings
Here are some of the prerequisites we need to go over before delving into lectures.
If you don't already have R installed, you can download it from here. I am using R version 3.5.2 but probably examples would work just as well with minor version differences.All examples are run via RStudio. You can download it from here.
When you first run RStudion, make sure to set up a working folder for your session. You can do this from the menu Session -> Set Working Directory -> Choose Directory. Once you do that all files that you will save will be in this folder. For example if you want to save a dataframe called df, all you need to do is type the following the R Terminal, which is the bottom left window.
> saveRDS(df, file = "df.rds")
Sample files are provided as rds file. To load them into your workspace, copy the file to your working folder type the following (replaceing df.rds with the real file name).
> readRDS(df, file = "df.rds")
We will be using various R packages throughout our lectures. You will need to install them before using it. For example, we will use ggplot2 package for graphics. To install it, type the following:
> install.packages("ggplot2")
Before using ggplot2, we have to load it at each session (contrary to install which you only need to do once). To do that:
> library(ggplot2)
Leave a Comment