The following will walk you through installing R, RStudio, and GitHub Desktop. Though the instructions are long, it hopefully will not take you long to get set up. You will need admin access on your laptop.

If you run into trouble, you can post in the comment section at the bottom. Please, help each other out in the comments if you can solve someone’s installation issues. I will check in periodically and try to help too.

Get an account on GitHub

If you don’t already have an account on GitHub, go to github.com and click the “sign up” link near upper right of the page. It is pretty self-explanatory. Go ahead and get a free account.

The free GitHub account does not have private repositories. Everything is public and viewable. You can upgrade (for money) and get private repositories. Or if you are a student, you can get private repositories from GitHub for free. Go to https://education.github.com/pack to sign up for your free student pack. You will need to upload proof that you are a student or faculty.

Install GitHub Desktop (Windows and Mac users)

Windows users: GitHub Desktop is only available for 64-bit

  1. Go to desktop.github.com and install.
  2. Open GitHub Desktop, go to ‘GitHub Desktop > Preferences’ menu.
  3. Under ‘Accounts’, sign into your GitHub account.
  4. Under ‘Git’, enter your name (or initials) and the email you used for your GitHub account.

Linux users can install Git and interact with GitHub though RStudio. GitHub Desktop is not essential for the course, however it is a standard R Workflow that I will be demonstrating.

You should not need to install Git as that comes with GitHub Desktop, however it is possible that you will need to to interact with RStudio. If so, download and install Git from git-scm.

Install R and RStudio

Set up RStudio to use Git

  1. Open RStudio
  2. Go to Global Options (from the Tools menu)
  3. Click Git/SVN
  4. Click Enable version control interface for RStudio projects

Linux users will need to install Git for this to work.

Windows/Mac users: Git comes with GitHub Desktop. If RStudio complains that it cannot find Git: 1. Make sure you set your Preferences in GitHub Desktop. 2. Download and install Git from from git-scm.

Install R packages

If you get an error saying that the repository cannot be found: 1. Check that you are online. 2. Run chooseCRANmirror() and choose a mirror. 3. Repeat until you find a mirror that has the up to date packages.

From the command line in R Studio

  1. bookdown: package. Enter the following code at the command line (>).
install.packages("devtools")  
devtools::install_github("rstudio/bookdown")
  1. Install other packages that we are going to be need. I have created a package on GitHub that will install the packages you need. This will probably take awhile as the first time you do it, many packages will be loaded.
devtools::install_github("RVerse-Tutorials/RWorkflowsetup")
  1. If you do not have LaTeX installed, you can install the tinytex package. Run these commands. This will allow you to make PDF files from R Markdown files.
install.packages('tinytex')
tinytex::install_tinytex()

Create a workshop folder

Create a folder/directory on your computer for the workshop materials. You can create it anywhere you wish. Name it RWorkflow just so we all use the same folder name for the workshop.

Disqus forum

I have added a Disqus forum to the website. Create an account if you would like to be able to add comments/questions. This will allow people to pose questions to the group and allow me (and others) to answer.

Downloading repositories

In case we do not have internet access, I will provide the files on a thumb drive also.

You will need to fork (copy) repositories from RVerse-Tutorials for many of the labs. You can also download zip files.

  1. Log into GitHub.
  2. Go to RVerse-Tutorials/Test.
  3. Click ‘Fork’ in the upper right corner of the repository. This will create a copy of Test-Website in your GitHub account.
  4. Open RStudio. Click File > New Project > Version Control
  5. Paste in the url of the repository you are copying—the forked repository in your GitHub account. For example, https://github.com/<youraccount>/Test You can leave project name blank. Replace <youraccount> with your GitHub account.
  6. You should now be able to see the files from Test in RStudio. There is only one file, README.md.

Watch a video that shows you how to fork a repository

Packages with C++ code (Optional)

We will not be doing this in this short course, but often you will want to install packages with C++ code. To do that, you will need Rtools (Windows) or Xcode (Mac)

  • Rtools Windows users Rtools also so you can build packages with C++ code if needed. See comments here about changing path. Rtools

  • Xcode Mac users Open terminal and type the following command xcode-select --install