From 125f518088800465b08776545a71b2cb53405f92 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 11 Jul 2024 21:25:39 +0300 Subject: [PATCH] Remove unsupported array syntax formatting example --- R/model.R | 28 +++++++--------------------- man/model-method-format.Rd | 28 +++++++--------------------- 2 files changed, 14 insertions(+), 42 deletions(-) diff --git a/R/model.R b/R/model.R index 39612e44..6d4cd7bc 100644 --- a/R/model.R +++ b/R/model.R @@ -969,26 +969,6 @@ CmdStanModel$set("public", name = "check_syntax", value = check_syntax) #' @examples #' \dontrun{ #' -#' # Example of fixing old syntax -#' # real x[2] --> array[2] real x; -#' file <- write_stan_file(" -#' parameters { -#' real x[2]; -#' } -#' model { -#' x ~ std_normal(); -#' } -#' ") -#' -#' # set compile=FALSE then call format to fix old syntax -#' mod <- cmdstan_model(file, compile = FALSE) -#' mod$format(canonicalize = list("deprecations")) -#' -#' # overwrite the original file instead of just printing it -#' mod$format(canonicalize = list("deprecations"), overwrite_file = TRUE) -#' mod$compile() -#' -#' #' # Example of removing unnecessary whitespace #' file <- write_stan_file(" #' data { @@ -1003,8 +983,14 @@ CmdStanModel$set("public", name = "check_syntax", value = check_syntax) #' poisson_lpmf(y | lambda); #' } #' ") +#' +#' # set compile=FALSE then call format to fix old syntax #' mod <- cmdstan_model(file, compile = FALSE) -#' mod$format(canonicalize = TRUE) +#' mod$format(canonicalize = list("deprecations")) +#' +#' # overwrite the original file instead of just printing it +#' mod$format(canonicalize = list("deprecations"), overwrite_file = TRUE) +#' mod$compile() #' } #' format <- function(overwrite_file = FALSE, diff --git a/man/model-method-format.Rd b/man/model-method-format.Rd index d24010a4..9aa744a7 100644 --- a/man/model-method-format.Rd +++ b/man/model-method-format.Rd @@ -47,26 +47,6 @@ model directly back to the file or prints it for inspection. \examples{ \dontrun{ -# Example of fixing old syntax -# real x[2] --> array[2] real x; -file <- write_stan_file(" -parameters { - real x[2]; -} -model { - x ~ std_normal(); -} -") - -# set compile=FALSE then call format to fix old syntax -mod <- cmdstan_model(file, compile = FALSE) -mod$format(canonicalize = list("deprecations")) - -# overwrite the original file instead of just printing it -mod$format(canonicalize = list("deprecations"), overwrite_file = TRUE) -mod$compile() - - # Example of removing unnecessary whitespace file <- write_stan_file(" data { @@ -81,8 +61,14 @@ model { poisson_lpmf(y | lambda); } ") + +# set compile=FALSE then call format to fix old syntax mod <- cmdstan_model(file, compile = FALSE) -mod$format(canonicalize = TRUE) +mod$format(canonicalize = list("deprecations")) + +# overwrite the original file instead of just printing it +mod$format(canonicalize = list("deprecations"), overwrite_file = TRUE) +mod$compile() } }