AddFunctionToPkg.RdAdd a new function named strFunctionName to a package. This function creates a file named R/strFunctionName.R and adds a test function in the file tests/testthat/test-strFunctionName.R to be used with the testthat package.
AddFunctionToPkg( strFunctionName = "MyNewFunction", strFunctionDescription = "Add Description", strPkgDir = getwd(), strFunctionTemplate = NULL, strTestTemplate = NULL )
| strFunctionName | The name of the function to add. |
|---|---|
| strFunctionDescription | A description to include at the top of the file with the function. |
| strPkgDir | The directory of the package to add the function to. If this parameter is left blank then the current working directory will be used. |
| strFunctionTemplatePath | Path to a function template. /inst/Templates/FunctionTemplate.R used as default. |
| stTestTemplatePath | Path to a test template. /inst/Templates/TestTemplate.R. |