Hello R!

This activity will introduce you to the course computing workflow. The main goal is to demo R and RStudio outside of lecture in a more independent setting.

Note

R is the name of the programming language itself and RStudio is a convenient interface.

A goal of this activity is to set up + practice with Git and GitHub, the collaboration and version control system that we will be using throughout the course.

Note

Git is a version control system (like “Track Changes” features from Microsoft Word but more powerful) and GitHub is the home for your Git-based projects on the internet (like DropBox but much better).

By the end of the activity, you will…

Log in to RStudio

Set up your SSH key

You will authenticate GitHub using SSH. Below are an outline of the authentication steps; you are encouraged to follow along as I demonstrate the steps.

Note

You only need to do this authentication process one time on a single system.

  • Type credentials::ssh_setup_github() into your console.
  • R will ask “No SSH key found. Generate one now?” You should type 1 for yes and hit enter.
  • You will generate a key. R will then ask “Would you like to open a browser now?” You should type 1 for yes and hit enter.
  • You may be asked to provide your GitHub username and password to log into GitHub. After entering this information, you should 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., st295).

You can find more detailed instructions here if you’re interested.

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. (And we also need to install a package called gert just for this step.)

Type the following lines of code in the console in RStudio filling in your name and the email address associated with your GitHub account.

Note: Your name is the name in your GitHub profile.

devtools::install_github("r-lib/gert")

usethis::use_git_config(
  user.name = "Your name", 
  user.email = "Email associated with your GitHub account"
  )

For example, mine would be

devtools::install_github("r-lib/gert")

usethis::use_git_config(
  user.name = "Elijah Meyer", 
  user.email = "esmeyer2@ncsu.edu"
  )

You are now ready interact with GitHub via RStudio!