View source: R/helpers-model.R
use_model_template | R Documentation |
Create a file with a template for adding a new model (for developers)
use_model_template(
model_name,
custom_family = FALSE,
stanvar_blocks = c("data", "tdata", "parameters", "tparameters", "model", "likelihood",
"genquant", "functions"),
open_files = TRUE,
testing = FALSE
)
model_name |
A string with the name of the model. The file will be named
|
custom_family |
Logical; Do you plan to define a brms::custom_family()?
If TRUE the function will add a section for the custom family, placeholders
for the stan_vars and corresponding empty .stan files in
|
stanvar_blocks |
A character vector with the names of the blocks that
will be added to the custom family section. See |
open_files |
Logical; If TRUE (default), the function will open the template files that were created in RStudio |
testing |
Logical; If TRUE, the function will return the file content but will not save the file. If FALSE (default), the function will save the file |
If you get a warning during check() about non-ASCII characters, this is often due to the citation field. You can find what the problem is by running
remotes::install_github("eddelbuettel/dang") dang::checkPackageAsciiCode(dir = ".")
usually rewriting the numbers (issue, page numbers) manually fixes it
If testing
is TRUE, the function will return the file content as a
string. If testing
is FALSE, the function will return NULL
library(usethis)
# create a new model file without a brms::custom_family, and open the file
use_model_template("newmodel")
# create a new model file with a brms::custom_family, three .stan files in
# inst/stan_chunks/ and open the files
use_model_template("abc",
custom_family = TRUE,
stanvar_blocks = c("functions", "likelihood", "tdata")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.