What is the canonical procedure for starting a new package that you want to put on GitHub (etc)?
When I start a New Project, I have the option to either check out a directory from version control or to create a package. Currently, my procedure is to create a new repository on GitHub, then start a new project by checking out that repository, then doing a dance using devtools::create()/ package.skeleton etc, deleting files, and restarting RStudio, until the version control is synced and RStudio recognizes that this is a package project. Or I clone the repository outside of RStudio and then start the project in that directory.
This dance only happens when I want to start a package, so the overhead is no big deal. (Though in a class it's noticeable.) But I wonder if there's a better way to combine these apparently mutually exclusive ways to start a project. I understand it would be a pain to develop an option to create a new repository, clone it, and start a new package all in one step, because starting a package afresh allows you to safely make a lot of assumptions about the directory contents.
I go through the same song and dance too. Create on github, create project in RStudio, etc. But I do know that usethis::use_github() is a thing. I have never tried it though.
Update: I'm about to post an updated response, incorporating some feedback and in light of usethis changes made as a result of this productive discussion!
I think this is easiest:
Create repo on GitHub (YES to Initialize this repository with a README)
Capture URL from the big green "Clone or download" button
Make a new RStudio Project with this URL
usethis::create_package(getwd()) (hmm ... maybe that should be less awkward?). Note: usethis is not on CRAN yet.
Sticking to CRAN packages does involve a bit more friction.
The "GitHub first" approach:
Create repo on GitHub (YES to Initialize this repository with a README)
Capture URL from the big green "Clone or download" button; new RStudio Project from that
devtools::setup()
Quit and Relaunch RStudio in this Project.
The "GitHub last" approach:
From a running RStudio instance: devtools::create("path/to/your/new/pkg").
Also from the existing RStudio instance: browseURL("path/to/your/new/pkg.Rproj") to launch a new instance of RStudio in the new pkg/Project.
Good call, Noam! @hughparsonage, the mason template for a "minimal R package" is here (you'll of course also need mason, which @noamross linked to above)!