Add flat Rmd file that drives package development

add_additional(
  pkg = ".",
  dev_dir = "dev",
  flat_name = "additional",
  overwrite = FALSE,
  open = TRUE
)

add_minimal(
  pkg = ".",
  dev_dir = "dev",
  flat_name = "minimal",
  overwrite = FALSE,
  open = TRUE
)

add_full(
  pkg = ".",
  dev_dir = "dev",
  flat_name = "full",
  overwrite = FALSE,
  open = TRUE
)

add_flat_template(
  template = c("full", "minimal", "additional", "teaching", "dev_history"),
  pkg = ".",
  dev_dir = "dev",
  flat_name = template,
  overwrite = FALSE,
  open = TRUE
)

Arguments

pkg

Path where to save file

dev_dir

Name of directory for development Rmarkdown files. Default to "dev".

flat_name

Name of the file to write in dev. Use the name of the main function of your template to get chunks pre-filled with this function name.

overwrite

Whether to overwrite existing flat Rmd template file with same name

open

Logical. Whether to open file after creation

template

Name of the template to use. See details.

Value

Create flat Rmd file(s) template(s) and return its (their) path

Details

Choose template among the different templates available:

  • "full": The full template with a reproducible package that can directly be inflated. It comes along with the "dev_history" template. Default.

  • "minimal": Minimal template to start a new package when you already know fusen, along with the "dev_history" template.

  • "additional": Template for an additional vignette or set of additional functions.

  • "teaching": Template with a reproducible package, simpler than "full", but everything to teach the minimal structure of a package.

  • "dev_history": Template with functions commonly used during package development. This does not contain chunks to write your own functions.

Abbreviated names can also be used for the different templates: "add" for additional, "min" for minimal, "teach" for teaching, "dev" for "dev_history".

add_additional(), add_minimal(), add_full() are wrapper around add_flat_template("additional"), ... However, add_dev_history() is a deprecated function from a previous version.

Examples

# Create a new project
dummypackage <- tempfile("dummypackage")
dir.create(dummypackage)

# Add
add_flat_template(template = "teaching", pkg = dummypackage)
#> Created file .here in /tmp/RtmpNhecPP/dummypackage3f933242fecc . Please start a new R session in the new project directory.
#> [1] "/tmp/RtmpNhecPP/dummypackage3f933242fecc/dev/flat_teaching.Rmd"
# Delete dummy package
unlink(dummypackage, recursive = TRUE)

# For classical use in your package
if (FALSE) {
# first time ever using 'fusen'
add_flat_template("full")

# first time in your new package
add_flat_template("minimal")

# add new flat file for new functions
add_flat_template("add")

# add new flat template for teaching (a reduced full template)
add_flat_template("teaching")
#'
}