Skip to content

Writing vignettes

Neal Fultz edited this page Apr 6, 2018 · 3 revisions

Typically, a design vignette will contain three sections:

  • Default settings These are the parameters used for an example run - generally generated using the template_default_args_text function, which uses the first element of the default function paramaters.

    To test:

designs:::template_default_args_text(my_template)

  • Template body The "body" of a template, where the steps and design are declared. Typically used via template_text() - which uses the code between {{{ and }}}

    To test:

designs:::template_text(my_template)

  • Diagnosis The diagnosis of a design can be computationally intensive - to work around that, the designs package masks the default implmentation of diagnose_design - becuase designs Depends: DeclareDesign this should work regardless of package loading orders. This will generate an RDS file that should be checked in to git in order to keep build times reasonable.

Extra packages

Some designs may need extra packages. Add the extra to "Enhances" in the DESCRIPTION, and in the test use skip_if_not_installed. In the actual template, use package::fun to access it - do not attach the package.

Clone this wiki locally