-
Notifications
You must be signed in to change notification settings - Fork 3
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_textfunction, 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
designspackage masks the default implmentation ofdiagnose_design- becuase designsDepends: DeclareDesignthis should work regardless of package loading orders. This will generate anRDSfile that should be checked in to git in order to keep build times reasonable.
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.