1 Deploy R Package on Github
Click Start Over at the left bottom to start
Back to Content
1.1 Prepare Git and Github
Open a free account on Github:
comtook
comes from “computational toolkits”
Install Git:
sudo apt-get install git-core
Start rstudio
Click tools –> global options –> Git/SVN
Click Enable version control interface for RStudio projects
Sign in Github as the owner/administrator
Open a new repository
Check the option there to initialize the repository with a README file
1.2 Make R package
On Rstudio, File –> New Project –> Create a new project from Version Control
Choose Git
Provide the repository URL including the new repository name:
https://github.com/comtook/afmFreeEnergy
Choose a project directory name on my local computer:
afmFreeEnergy
Click Create Project
Change to use
devtools
tools: library(devtools)
Create the package skeleton with devtools::create(‘~/afmFreeEnergy’)
Choose Overwrite files
Edit the information in DESCRIPTION
Put my codes in the R/ subdirectory
Copy raw data in the folder inst/extdata
Re-load packge with devtools::load_all()
Re-generate documentation and namespace: devtools::document(‘/path/to/pkg’)
Build binary: devtools::build()
Install: devtools::install(‘/path/to/pkg’)
Re-load: library(‘pkg’)
1.3 Publish my R package on Github
use Rstudio interface Git
Git –> Commit –> Push
or create a new repository on the command line
echo “# afmFreeEnergy” >> README.md
git init
git add README.md
git commit -m “first commit”
git remote add origin
https://github.com/comtook/afmFreeEnergy.git
git push -u origin master
or push an existing repository from the command line
git remote add origin
https://github.com/comtook/afmFreeEnergy.git
git push -u origin master
1.4 Install R package from Github
library(devtools)
install_github(“comtook/afmFreeEnergy”) or
sudo su - -c “R -e "devtools::install_github(‘comtook/afmFreeEnergy’)\”"
1.5 Specify version
to use the “double colon” approach
Imports: data.table (>= 1.9.4), dplyr
1.6 Delete repository on Github
Sign in as the owner/administrator
On GitHub, navigate to the main page of the repository
Under your repository name, click Settings
Scroll down to “Danger Zone” and click “Delete this Repository”
Follow the instruction
On your local machine, delete .git directory/folder within the repository’s directory
1 Deploy R Package on Github