R, RStudio, Git, Github

Install R

Go to https://rstudio.com/products/rstudio/download/ and click on the first link. Then click on “Download R for Mac” for Mac. On Windows, you https://cran.r-project.org/bin/windows/base/. There are several other options available for all major Linux distributions.

And then choose the .pkg file. The installation is pretty basic. On Windows, you will get a installer .exe file.

Install RStudio Desktop

Go to https://rstudio.com/products/rstudio/download/ again and this time, choose the .dmg download for Mac. The installation is pretty basic as well. You will get an installer for Windows. There are several other options available for all major Linux distributions.

Install Git

Installation on Mac

On Mac there are several ways to install git. We will do it by using Homebrew. Go to https://git-scm.com/download/mac and click on the ‘install Homebrew’ link

On Homebrew, copy the link they provide to you for installing the application.

When you have copied the link, go to the Terminal on your Mac (if you don’t know how to find it, go to the Spotlight search function in your upper right corner and search for Terminal). In the Terminal, paste the Homebrew link and hit enter. The installation will start (although you may have to fill in your password sometimes).

When Homebrew is installed, you can now use this application to retrieve Git. Go to your terminal once again, and now type in the command that can be found on the https://git-scm.com/download/mac page on your Terminal ( $ brew install git). The installation follows.

To check if you installed Git, you can enter the following command: $ git –version. Your Terminal will, if everything went as planned, show you the latest version of git that has been installed on your Mac.

Connecting to GitHub

  1. First, make an account on GitHub.com and choose a suitable, professional name for yourself.
  1. When logged in, ask Daniel to add you to the projects you will collaborate on and the Data Observatory organization page on https://github.com/dataobservatory-eu. If everything went well, you will see these pages appear on your dashboard:

Working with your team on GitHub

  1. To start off, go to the project page you’re contributing to and click fork to create your own repository within this project.

Working offline with RStudio via GitHub

  1. Now, open RStudio and go to File > Create New Project. Click on Version Control. You want a new project started that has Git version control.
  1. Choose Git.
  1. Enter the link of the repository you created at 5a. It should have your account name in it like in https://github.com/yourname/practice-markdown , since it is your personal repository. Also choose a suitable folder where you can easily find your files.
  1. Login with your GitHub account (if you have already done this, it will probably automatically skip this part.) RStudio and GitHub can work together with your username/password combination, or via permanent SSH authentication. You can also read here how to stay permanently logged in with secure, SSH authentication.
  1. When you’re logged in, you can now share and edit files with your peers using RStudio and GitHub. As an example, we will add something to the ReadMe.d file of the project. I’ve added

anything

  1. After this, save the file and go to the right side of the screen. Here the readme.file appears. Make sure it is selected and click on “commit”. By commiting the file, we can add notes about the changes we made in the file for our teammembers, so they know what happened.
  1. Add your notes in the right part on the screen and click commit. You can add different notes for every line you added or made changes on. For now, it’s just this one addition of the word

anything

  1. Go back to your dashboard, make sure the files you want to upload are selected (in this case, just the ReadMe.md file) and click on the Push button (green arrow). The file is now uploaded to the shared GitHub project.
  1. To actually share the changes you made with your colleagues, go to your GitHub repository and click on New Pull Request.
  1. The file is now shared and your additions can be reviewed by your peers.

Your work is now merged and synchronized to the master document

  1. When someone reviewed your file, you can also bring back those files in your RStudio. This works the other way around, you go to RStudio, and now click the Pull button (the blue arrow). RStudio will now check if there are any new files to download.

Questions? Please reach out to Daniel on https://keybase.io/antaldaniel