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() } }