View source: R/tmb_create_package.R
tmb_create_package | R Documentation |
Create a TMB package.
tmb_create_package( path, tmb_files = character(), fields = NULL, open = interactive(), example_code = FALSE )
path |
Absolute or relative path to where the package is to be created. If the path exists, it is used. If it does not exist, it is created, provided that the parent path exists. |
tmb_files |
Optional character vector of TMB header files to include in the package. See Details. |
fields, open |
Same function as corresponding arguments in |
example_code |
Adds example TMB files to the package (see Examples). |
Calls usethis::create_package
followed by use_tmb
and export_models
, which add the TMB infrastructure and initialize the provided TMB model list, respectively. Please see documentation for these functions as to how exactly a TMB-enabled package should be set up.
Nothing; called for its side effect.
use_tmb
for adding TMB infrastructure to an existing package,export_models
for adding TMB model files after the package is created.
## Not run: # create package with example code tmb_create_package(path = "TMBTestPackage", example_code = TRUE) # the following steps will add R functions and tests # for which the resulting package will pass R CMD check --as-cran # need to have the following packages installed: # - devtools # - usethis # - numDeriv # run the following from within any of the TMBTestPackage subdfolders # wrapper functions to TMB models usethis::use_template(template = "norm_ADFun.R", package = "TMBtools", save_as = file.path("R", "norm_ADFun.R"), data = list(pkg = "TMBTestPackage")) usethis::use_template(template = "gamma_ADFun.R", package = "TMBtools", save_as = file.path("R", "gamma_ADFun.R"), data = list(pkg = "TMBTestPackage")) # testthat tests usethis::use_testthat() usethis::use_package(package = "numDeriv", type = "Suggests") usethis::use_template(template = "test-norm_ADFun.R", package = "TMBtools", save_as = file.path("tests", "testthat", "test-norm_ADFun.R")) usethis::use_template(template = "test-gamma_ADFun.R", package = "TMBtools", save_as = file.path("tests", "testthat", "test-gamma_ADFun.R")) # create roxygen documentation pkgbuild::compile_dll() # need to compile src first devtools::document() # essentially equivalent to R CMD check --as-cran devtools::check() ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.