Tomas Greif Tomas Greif - 5 months ago 39
R Question

Start new R package development on github

How do I create new repository on github using devtools in RStudio? I've tried to:

  1. Create empty repository on github named "MyNewRPackage"

  2. Started new project in RStudio using ssh connection to my git repository

  3. Installed and loaded devtools

Then I thought I will use
to initialize directory structure and
file. But the package skeleton is created as subfolder of my project and I have
. But I need to create package skeleton in the root folder of my github repository.

What is the standard way to start new R package development on github using devtools and RStudio?


Hope this helps someone:

  1. Create empty repository on github (I will use name rpackage in this example)
  2. Create package locally using devtools, create("rpackage") (this will create rpackage folder)
  3. Create new project in RStudio (Create project from: Existing directory) and choose rpackage directory
  4. In RStudio go to Tools/Shell... and type git init
  5. Reopen the project (this will refresh the Git tab)
  6. Start Git/More/Shell and type

    git add *

    git commit -m "first commit"

    git remote add origin[username]/rpackage.git

    git push -u origin master

Then you can refresh repository on github. Now you can close (or even delete) your local project and next time you can start a new project Project/New project/Version Control/Git