For this set of exercises as well as all following ones, we suggest
that you write R scripts (one per set of exercises or a
combined one for the whole course) and store them in the
my_scripts folder contained in the course materials. This
folder already contains a script stub called my_script.R
which you can use for getting started.
R packages are out there that may be of
interest for you, have a brief (!) look at the CRAN Task View
section called SocialSciences and do a quick search for
“regression” on METACRAN.
CRAN (we will use those later on in the
course). Please install the following packages: remotes,
dplyr, janitor, correlation
(Note: We will need a few more packages throughout this course,
but we do not have to install all of them now).
install.packages(c("remotes", "dplyr", "janitor", "correlation"))
remotes package.
library(remotes)
CRAN. Another important source of
R packages is GitHub (especially for development
versions). So, let’s install a package from there. Install the emo package from
GitHub. NB: To be able to install packages
from GitHub on Windows machines, you will need to
install Rtools
first.
remotes package for this.
The required argument for the function for installing a package from
GitHub needs to be in the form “user_name/repo_name” (i.e., the
parts of the URL that come after github.com). If you need to install
Rtools, make sure to select the version that is appropriate
for your version of R.
library(remotes)
install_github("hadley/emo")
installed.packages()
my_scripts folder).
R start with #. Ideally, these should explain
what the code you have written does. You can simply save the
R script file via the RStudio GUI.
# Check installed packages
installed.packages()