From 8e8e0f4d222f035bcd01572782fb95f5c3141281 Mon Sep 17 00:00:00 2001 From: Sebastian Funk Date: Mon, 13 May 2024 09:43:31 +0100 Subject: [PATCH] add example --- R/model.R | 3 +++ man/CmdStanModel.Rd | 3 +++ man/cmdstan_model.Rd | 3 +++ man/cmdstanr-package.Rd | 3 +++ man/model-method-optimize.Rd | 3 +++ man/model-method-pathfinder.Rd | 3 +++ man/model-method-sample.Rd | 3 +++ man/model-method-variational.Rd | 3 +++ 8 files changed, 24 insertions(+) diff --git a/R/model.R b/R/model.R index 9e9e2058..0a1cb1c1 100644 --- a/R/model.R +++ b/R/model.R @@ -54,6 +54,9 @@ #' file <- file.path(cmdstan_path(), "examples/bernoulli/bernoulli.stan") #' mod <- cmdstan_model(file) #' mod$print() +#' # Print with line numbers. This can be set globally using the +#' # `cmdstanr_print_line_numbers` option. +#' mod$print(line_numbers = TRUE) #' #' # Data as a named list (like RStan) #' stan_data <- list(N = 10, y = c(0,1,0,0,0,0,0,0,0,1)) diff --git a/man/CmdStanModel.Rd b/man/CmdStanModel.Rd index 55200357..8bb3fdaf 100644 --- a/man/CmdStanModel.Rd +++ b/man/CmdStanModel.Rd @@ -73,6 +73,9 @@ set_cmdstan_path(path = NULL) file <- file.path(cmdstan_path(), "examples/bernoulli/bernoulli.stan") mod <- cmdstan_model(file) mod$print() +# Print with line numbers. This can be set globally using the +# `cmdstanr_print_line_numbers` option. +mod$print(line_numbers = TRUE) # Data as a named list (like RStan) stan_data <- list(N = 10, y = c(0,1,0,0,0,0,0,0,0,1)) diff --git a/man/cmdstan_model.Rd b/man/cmdstan_model.Rd index b0432abc..bca22a30 100644 --- a/man/cmdstan_model.Rd +++ b/man/cmdstan_model.Rd @@ -59,6 +59,9 @@ set_cmdstan_path(path = NULL) file <- file.path(cmdstan_path(), "examples/bernoulli/bernoulli.stan") mod <- cmdstan_model(file) mod$print() +# Print with line numbers. This can be set globally using the +# `cmdstanr_print_line_numbers` option. +mod$print(line_numbers = TRUE) # Data as a named list (like RStan) stan_data <- list(N = 10, y = c(0,1,0,0,0,0,0,0,0,1)) diff --git a/man/cmdstanr-package.Rd b/man/cmdstanr-package.Rd index 739213ff..eb8ae80c 100644 --- a/man/cmdstanr-package.Rd +++ b/man/cmdstanr-package.Rd @@ -89,6 +89,9 @@ set_cmdstan_path(path = NULL) file <- file.path(cmdstan_path(), "examples/bernoulli/bernoulli.stan") mod <- cmdstan_model(file) mod$print() +# Print with line numbers. This can be set globally using the +# `cmdstanr_print_line_numbers` option. +mod$print(line_numbers = TRUE) # Data as a named list (like RStan) stan_data <- list(N = 10, y = c(0,1,0,0,0,0,0,0,0,1)) diff --git a/man/model-method-optimize.Rd b/man/model-method-optimize.Rd index 55d7758f..ac8f9f65 100644 --- a/man/model-method-optimize.Rd +++ b/man/model-method-optimize.Rd @@ -245,6 +245,9 @@ set_cmdstan_path(path = NULL) file <- file.path(cmdstan_path(), "examples/bernoulli/bernoulli.stan") mod <- cmdstan_model(file) mod$print() +# Print with line numbers. This can be set globally using the +# `cmdstanr_print_line_numbers` option. +mod$print(line_numbers = TRUE) # Data as a named list (like RStan) stan_data <- list(N = 10, y = c(0,1,0,0,0,0,0,0,0,1)) diff --git a/man/model-method-pathfinder.Rd b/man/model-method-pathfinder.Rd index c3a2044b..90578282 100644 --- a/man/model-method-pathfinder.Rd +++ b/man/model-method-pathfinder.Rd @@ -270,6 +270,9 @@ set_cmdstan_path(path = NULL) file <- file.path(cmdstan_path(), "examples/bernoulli/bernoulli.stan") mod <- cmdstan_model(file) mod$print() +# Print with line numbers. This can be set globally using the +# `cmdstanr_print_line_numbers` option. +mod$print(line_numbers = TRUE) # Data as a named list (like RStan) stan_data <- list(N = 10, y = c(0,1,0,0,0,0,0,0,0,1)) diff --git a/man/model-method-sample.Rd b/man/model-method-sample.Rd index bc5b2a8c..9b0b1ac4 100644 --- a/man/model-method-sample.Rd +++ b/man/model-method-sample.Rd @@ -348,6 +348,9 @@ set_cmdstan_path(path = NULL) file <- file.path(cmdstan_path(), "examples/bernoulli/bernoulli.stan") mod <- cmdstan_model(file) mod$print() +# Print with line numbers. This can be set globally using the +# `cmdstanr_print_line_numbers` option. +mod$print(line_numbers = TRUE) # Data as a named list (like RStan) stan_data <- list(N = 10, y = c(0,1,0,0,0,0,0,0,0,1)) diff --git a/man/model-method-variational.Rd b/man/model-method-variational.Rd index 3892d886..417a647a 100644 --- a/man/model-method-variational.Rd +++ b/man/model-method-variational.Rd @@ -245,6 +245,9 @@ set_cmdstan_path(path = NULL) file <- file.path(cmdstan_path(), "examples/bernoulli/bernoulli.stan") mod <- cmdstan_model(file) mod$print() +# Print with line numbers. This can be set globally using the +# `cmdstanr_print_line_numbers` option. +mod$print(line_numbers = TRUE) # Data as a named list (like RStan) stan_data <- list(N = 10, y = c(0,1,0,0,0,0,0,0,0,1))