View source: R/addUtilsFunctions.R
addUtilsFunctions | R Documentation |
This function copies handy utility functions to a new script in a specified location. Currently, the script contains the following utility functions:
.assertScalar()
- convenience function to check the validity
of scalar variables.
.assertVector()
- convenience function to check the validity
of vector variables.
.assertPackagesAvailable()
- convenience function to check if
packages are available, and suggest how to install them otherwise.
.message()
- a drop-in replacement for message() that only
prints a message if a variable named verbose is available in the
calling environment and is set to TRUE.
In addition to copying the files, the function also runs
usethis::use_package("cli")
to add the cli
package to the
Imports
of your package.
addUtilsFunctions(outFile = "R/utils.R", copyTests = TRUE)
outFile |
Character scalar, giving the path to which the script should be copied. The path is relative to the root of the active project. If a file with this name already exists, the function will ask for confirmation before overwriting it. |
copyTests |
Logical scalar, defining whether to copy unit tests for
the utility functions to |
Charlotte Soneson
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.