Skip to content

Instantly share code, notes, and snippets.

@steadyfish
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steadyfish/8ff00ebf3a2e9358907b to your computer and use it in GitHub Desktop.
Save steadyfish/8ff00ebf3a2e9358907b to your computer and use it in GitHub Desktop.
Creating R packages using RStudio, Git and GitHub
This method helps creating the proper R package directory structure using RStudio and then syncs it with the corresponding GitHub Project.
Sources:
http://www.molecularecologist.com/2013/11/using-github-with-r-and-rstudio/
https://support.rstudio.com/hc/en-us/articles/200532077-Version-Control-with-Git-and-SVN
http://r-pkgs.had.co.nz/git.html
Setup a GitHub account.
Download and install Rstudio.
Download and install the platform-specific version of Git (not GitHub), default options work well.
Configure Git with global commands. I have found this step necessary both times I ran through this process. Open up the bash version of Git and type the following:
git config –global user.name “your GitHub account name”
git config –global user.email “GitHubEmail@something.com”
Open Rstudio and set the path to Git executable. Go to Tools > Options > Git/SVN
Create a new R package from RStudio
Create a README file in the project/package directory.
Commit at least once.
Create a new project on GitHub.
Run following commands -
git remote add origin https://github.com/<GitHub user name>/<Project or package name>
git push -u origin master
From now on for usual Commit/Push functions Rstudio GUI commands can be used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment