How do I create new repository on github using devtools in RStudio? I've tried to:
Then I thought I will use create("MyNewRPackage")
to initialize directory structure and README.md
file. But the package skeleton is created as subfolder of my project and I have ~/MyNewRPackage/MyNewRPackage/R
. 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:
rpackage
in this example) create("rpackage")
(this will create rpackage folder) rpackage
directory git init
Start Git/More/Shell and type
git add *
git commit -m "first commit"
git remote add origin git@github.com:[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
You can specify the path to your github repository in create
instead of the package name:
create("/path/to/root/of/repository")
Then the normal git commands to add, commit and push to github:
git commit -a -m "initial commit" *
git push
Now there's setup()
, which creates the skeleton inside an existing directory. Together with hub
, this becomes:
git init NewPackage
cd NewPackage
Rscript -e "devtools::setup()"
hub create
git add .
git commit -m "initial"
git push -u origin HEAD
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.