Skip to contents

Overwrites the file at path with a built-in example Stan model file.

Usage

tar_stan_example_file(path = tempfile(pattern = "", fileext = ".stan"))

Arguments

path

Character of length 1, file path to write the model file.

Value

NULL (invisibly).

See also

Other examples: tar_stan_example_data()

Examples

path <- tempfile(pattern = "", fileext = ".stan")
tar_stan_example_file(path = path)
writeLines(readLines(path))
#> data {
#>   int <lower = 1> n;
#>   vector[n] x;
#>   vector[n] y;
#> }
#> parameters {
#>   real beta;
#> }
#> model {
#>   y ~ normal(x * beta, 1);
#>   beta ~ normal(0, 1);
#> }
#> generated quantities {
#>   array[n] real y_rep = normal_rng(x * beta, 1);
#> }