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

usethis::create_package("../r2dii.packagename")
usethis::use_rstudio()

Add minimal infrastructure

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()
use_github_links()
use_roxygen_md()
use_tidy_description()
# Control + Shift + E
check()
browse_github()

Extend infrastructure with templates

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()
check()

What else?

The r2dii.usethis includes many more templates

For inspiration you may also see this post

The ultimate source is the R packages book:



2DegreesInvesting/r2dii.usethis documentation built on Feb. 22, 2022, 9:47 a.m.