Skip to contents

Create initial script and test files for a function that is to be added to a package.

Usage

init_function(name, dir = ".", overwrite = FALSE)

Arguments

name

Name of the function. Should start with the function's category, followed by a specific name, separated by an underscore ('_') (e.g., 'init_function').

dir

Path to the package's development directory; default is the current working directory.

overwrite

Logical; if TRUE, replaces existing files with templates.

Value

Creates files in dir/R and dir/tests/testthat, attempts to navigate to the code file, and returns a character vector to their paths.

Examples

if (FALSE) {

# creates a skeleton for a `measure_new` function
init_function("measure_new")
}