You can read a whole book about Git and R Happy Git with R.
We will not be using Git in RStudio because it can be hard to set-up and hard to debug if you run into problems. If you want to use it, read these instructions.
In particular, read the part about how to set-up so you don’t have to enter your username and password for every commmit.
The ‘RWorkflowsetup’ package has a download function. This function will create a folder with the name of the repository. Here is code to download the repository ‘Rmarkdown-Tutorial’. For others, just change the name of the repository.
library(RWorkflowsetup)
repo = "Test"
download.repo(repo)
From RStudio, go to the menu option ‘File->New Project…’. Then from the resulting dialog, choose “Version Control”. Then choose “Git”. Then it asks for a “repository URL”. Supply this: https://github.com/RVerse-Tutorials/Test
and leave the “Project Directory Name” empty. And then choose a directory in which to put it and click OK.
git remote rm origin
This detaches the cloned repository from the remote repository on GitHub from where you cloned it. That will pull the RStudio project off of GitHub, make a local clone of it on your hard drive and open.
Go to https://github.com/RVerse-Tutorials/Test and click ‘Clone or download’ and chose ‘Download Zip’. Unzip and you’ll probably want to remove ‘master’ added to the end of the repository name.
If you chose, ‘Clone in Desktop’, you’ll need to open a terminal window, navigate to the new folder you just downloaded, and run the git code git remote rm origin
from within the terminal to detach the repository from the RVerse-Tutorials GitHub account.
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)