June 5, 2018
aliviateR
is a package to make your packagealiviateR::alval_flow()
does most of the dirty workusethis
package to create the package using code# install.packages('usethis') library(usethis)
usethis::create_package(path = '/Users/alval/Desktop/mypkg')
cd '/path/to/package' git clone https://github.com/your_username/your_package_name.git
usethis::edit_r_environ()
to easily access the right file for editing# Make sure your working directory is set to the package usethis::use_git(message = "my first commit") cred = git2r::cred_ssh_key(publickey = "/Users/alval/.ssh/id_rsa.pub", privatekey = "/Users/alval/.ssh/id_rsa") usethis::use_github(credentials = cred)
Package: mypkg
Version: 0.0.0.9000
Title: What the Package Does (One Line, Title Case)
Description: What the package does (one paragraph).
Authors@R: person("First", "Last", , "first.last@example.com", c("aut", "cre"))
License: What license it uses
Encoding: UTF-8
LazyData: true
ByteCompile: true
URL: https://github.com/avalcarcel9/mypkg
BugReports: https://github.com/avalcarcel9/mypkg/issues
usethis::use_package()
:usethis::use_package("ggplot2", type = "Imports") usethis::use_package("knitr", type = "suggests")
sessionInfo()
use_roxygen_md()
sets up roxygen2 and enables markdown mode so you can use markdown in your roxygen2 comment blocksuse_package_doc()
creates a skeleton documentation file for the complete package, taking the advantage of the latest roxygen2 features to minimize duplication between the DESCRIPTION and the documentation use_readme_rmd()
creates a README.Rmd to describe what your package does and why people should care about it use_readme_md()
creates a README.md to describe what your package does and why people should care about ituse_news_md()
creates a basic NEWS.md for you to record changesuse_vignette("vignette-name")
configures the DESCRIPTION and creates a .Rmd template in vignettes/usethis
provides some functions to create the badge code you'll add to the READMEusethis::use_badge("travis", href = "https://img.shields.io/travis/USER/REPO.svg", src = "https://shields.io/") usethis::use_cran_badge()
badgecreatr
is also very useful# devtools::install_github("rmhogervorst/badgecreatr") library(badgecreatr) badgecreatr::badge_travis(ghaccount = "avalcarcel9", ghrepo = "mypkg") badgecreatr::badge_codecov(ghaccount = "avalcarcel9", ghrepo = "mypkg") badgecreatr::badge_cran(packagename = "mypkg") badgecreatr::badge_packageversion(chunk = TRUE)
devtools
to do this with R code# install.packages('devtools') devtools::build(pkg = "mypkg", vignettes = TRUE) devtools::check(pkg = "mypkg")
Thank you for listening!