knitr::opts_chunk$set( echo = TRUE, comment = "#>", error = TRUE, collapse = TRUE )
The goal of this article is to show how to build r2dii-like packages. All code should run in R (default), or a Unix-like terminal (commented with # bash
).
For a more general explanation see https://r-pkgs.org/whole-game.html.
Setup a GitHub repo, and clone it locally.
Create a basic R package.
usethis::create_package("../r2dii.packagename")
usethis::use_rstudio()
library(r2dii.usethis) library(usethis) library(devtools)
# Public for projects that are mainly code use_mit_license() # Public for projects that are mainly data use_cc0_license() # Private use_proprietary_license()
browse_github()
.use_github_links()
use_roxygen_md()
use_tidy_description()
# Control + Shift + E check()
Confirm that R CMD check runs with 0 errors, 0 warnings, and 0 notes.
On GitHub consider tweaking collaboration and branch settings. For example:
browse_github()
install()
# Setup readme (e.g. adds a line to .buildignore) usethis::use_readme_rmd() # Overwrite pre-existing file 'README.Rmd' with r2dii's template use_template("README.Rmd", package = "r2dii.usethis") use_cran_badge()
Edit README.Rmd manually.
Spellcheck.
Knit README.Rmd.
Check that R CMD check results in 0 errors, warnings, and messages.
check()
The r2dii.usethis includes many more templates
For inspiration you may also see this post
The ultimate source is the R packages book:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.