install.packages("tidyverse")
install.packages("knitr")
install.packages("lme4")
install.packages("tidymodels")
install.packages("usethis")
install.packages("credentials")
Computing
You will need access to R/ RStudio and git for this course. There are two options to access the software:
Install R and RStudio on your laptop
- See installation and set up instructions below
Access RStudio through Docker container provided by Duke OIT
Reserve a generic RStudio container (there is no course specific container)
Follow Step 4: Set up git authentication and [Step 5: Configure git] to connect RStudio and GitHub.
Computing set up
Step 1: Install R/RStudio and git
You can install R/RStudio on your local machine and configure it to work with git and GitHub. The text Happy Git and GitHub for the useR is a great resource for working with RStudio and git. The steps are outlined below. Click on each link for more detail.
Install R and RStudio Desktop: posit.co/download/rstudio-desktop
- I recommend installing the desktop version not the preview release of RStudio
Install git: happygitwithr.com/install-git
Step 2: Install R packages
Below is a set of R packages we will use throughout the semester. This list is just to get you started; we will let you know as new R packages are required.
Step 3: Install Quarto
We will use Quarto (similar to R Markdown) to write up analyses. Download and install Quarto at quarto.org/docs/get-started
Step 4: Set up git authentication
You will authenticate GitHub using SSH.
Type
credentials::ssh_setup_github()
into your console.R will ask “No SSH key found. Generate one now?” Click 1 for yes.
You will generate a key. It will begin with “ssh-rsa….” R will then ask “Would you like to open a browser now?” Click 1 for yes.
You may be asked to provide your username and password to log into GitHub. This would be the ones associated with your account that you set up. After entering this information, paste the key in and give it a name. You might name it in a way that indicates where the key will be used, e.g.,
sta310
)
You can find more detailed instructions here if you’re interested.
Step 5: Configure git
We need to configure your git so that RStudio can communicate with GitHub. This requires two pieces of information: your name and email address.
To do so, you will use the use_git_config()
function from the usethis
package.
Type the following lines of code in the console in RStudio filling in your name and the email address associated with your GitHub account.
::use_git_config(
usethisuser.name = "Your name",
user.email = "Email associated with your GitHub account")
For example, mine would be
::use_git_config(
usethisuser.name = "Maria Tackett",
user.email = "maria.tackett@duke.edu")
You are now ready to conduct reproducible data analyses!