Skip to contents

Creates a ready-to-use project directory with a _targets.R pipeline, a parameterised Quarto report, optional renv dependency snapshot, optional GitHub Actions CI workflow, and a structured file layout following RAP best practices.

Usage

sus_rap_template(
  path,
  name,
  system = "SIM-DO",
  include_renv = TRUE,
  include_targets = TRUE,
  include_quarto = TRUE,
  include_github_actions = FALSE,
  lang = "pt"
)

Arguments

path

character(1) - Parent directory where <name>/ will be created (e.g. "~/projetos").

name

character(1) - Project name; becomes the directory name.

system

character(1) - DATASUS system for the template pipeline (e.g. "SIM-DO", "SINAN", "SIH"). Default "SIM-DO".

include_renv

logical(1) - Initialise renv for dependency management. Requires the renv package. Default TRUE.

include_targets

logical(1) - Create _targets.R and run.R. Default TRUE.

include_quarto

logical(1) - Create analysis.qmd. Default TRUE.

include_github_actions

logical(1) - Create .github/workflows/rap.yml. Default FALSE.

lang

character(1) - Language for generated comments and messages: "pt" (default), "en", or "es".

Value

Invisibly, the absolute path of the created project directory.

Generated structure

<name>/
|-- _targets.R          # targets pipeline
|-- run.R               # convenience runner: source + tar_make()
|-- analysis.qmd        # parameterised Quarto report
|-- R/
|   `-- functions.R     # custom analysis functions
|-- data/               # raw data (git-ignored)
|-- output/             # results (git-ignored)
|-- renv/               # renv library (when include_renv = TRUE)
|-- renv.lock
|-- .gitignore
`-- README.md

Examples

if (FALSE) { # \dontrun{
sus_rap_template(
  path   = "~/projetos",
  name   = "dengue_am",
  system = "SINAN",
  lang   = "pt"
)
} # }