format_code: Format Stan code

Description Usage Arguments

View source: R/code_formatting.R

Description

Format Stan code

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
format_code(
  code = "",
  file = NULL,
  use_stanc = FALSE,
  overwrite_file = FALSE,
  place_includes = FALSE,
  stanc_path = NULL,
  spaces = 2,
  verbose = FALSE
)

Arguments

code

Stan code as a string. Ignored if file is not NULL.

file

File that contains Stan code. If this is NULL, code is used as input.

use_stanc

Should the code be formatted using stanc3 with the --auto-format option? If this is

  • FALSE - code is formatted by handling strings in R.

  • TRUE - stanc must be installed. NOTE: Currently choosing this option will remove all comments from the code.

overwrite_file

Should the file that was given as input be overwritten by the formatted code? It is not recommended to set this to TRUE unless your code is backed up somewhere.

place_includes

Should #include statements be replaced by their respective content? (has no effect if use_stanc is TRUE).

stanc_path

Path to the parent directory of stanc. If this is NULL, an attempt is made to find stanc from the CmdStan path set by cmdstanr.

spaces

Number of spaces to use for indenting (has no effect if use_stanc is TRUE).

verbose

Should some informational messages be printed?


jtimonen/stanbreaker documentation built on Jan. 20, 2021, 12:34 a.m.