@@ -1149,8 +1149,8 @@ sample <- function(data = NULL,
11491149 show_messages = TRUE ,
11501150 show_exceptions = TRUE ,
11511151 diagnostics = c(" divergences" , " treedepth" , " ebfmi" ),
1152- save_metric = TRUE ,
1153- save_cmdstan_config = TRUE ,
1152+ save_metric = ifelse(cmdstan_version() > " 2.34.0 " , TRUE , NULL ) ,
1153+ save_cmdstan_config = ifelse(cmdstan_version() > " 2.34.0 " , TRUE , NULL ) ,
11541154 # deprecated
11551155 cores = NULL ,
11561156 num_cores = NULL ,
@@ -1243,7 +1243,7 @@ sample <- function(data = NULL,
12431243 window = window ,
12441244 fixed_param = fixed_param ,
12451245 diagnostics = diagnostics ,
1246- save_metric = if (cmdstan_version() > " 2.34.0 " ) save_metric else NULL
1246+ save_metric = save_metric
12471247 )
12481248 args <- CmdStanArgs $ new(
12491249 method_args = sample_args ,
@@ -1264,7 +1264,7 @@ sample <- function(data = NULL,
12641264 sig_figs = sig_figs ,
12651265 opencl_ids = assert_valid_opencl(opencl_ids , self $ cpp_options()),
12661266 model_variables = model_variables ,
1267- save_cmdstan_config = if (cmdstan_version() > " 2.34.0 " ) save_cmdstan_config
1267+ save_cmdstan_config = save_cmdstan_config
12681268 )
12691269 runset <- CmdStanRun $ new(args , procs )
12701270 runset $ run_cmdstan()
@@ -1361,7 +1361,7 @@ sample_mpi <- function(data = NULL,
13611361 show_messages = TRUE ,
13621362 show_exceptions = TRUE ,
13631363 diagnostics = c(" divergences" , " treedepth" , " ebfmi" ),
1364- save_cmdstan_config = TRUE ,
1364+ save_cmdstan_config = ifelse(cmdstan_version() > " 2.34.0 " , TRUE , NULL ) ,
13651365 # deprecated
13661366 validate_csv = TRUE ) {
13671367
@@ -1426,7 +1426,7 @@ sample_mpi <- function(data = NULL,
14261426 output_basename = output_basename ,
14271427 sig_figs = sig_figs ,
14281428 model_variables = model_variables ,
1429- save_cmdstan_config = if (cmdstan_version() > " 2.34.0 " ) save_cmdstan_config
1429+ save_cmdstan_config = save_cmdstan_config
14301430 )
14311431 runset <- CmdStanRun $ new(args , procs )
14321432 runset $ run_cmdstan_mpi(mpi_cmd , mpi_args )
@@ -1507,7 +1507,7 @@ optimize <- function(data = NULL,
15071507 history_size = NULL ,
15081508 show_messages = TRUE ,
15091509 show_exceptions = TRUE ,
1510- save_cmdstan_config = TRUE ) {
1510+ save_cmdstan_config = ifelse(cmdstan_version() > " 2.34.0 " , TRUE , NULL ) ) {
15111511 procs <- CmdStanProcs $ new(
15121512 num_procs = 1 ,
15131513 show_stderr_messages = show_exceptions ,
@@ -1549,7 +1549,7 @@ optimize <- function(data = NULL,
15491549 sig_figs = sig_figs ,
15501550 opencl_ids = assert_valid_opencl(opencl_ids , self $ cpp_options()),
15511551 model_variables = model_variables ,
1552- save_cmdstan_config = if (cmdstan_version() > " 2.34.0 " ) save_cmdstan_config
1552+ save_cmdstan_config = save_cmdstan_config
15531553 )
15541554 runset <- CmdStanRun $ new(args , procs )
15551555 runset $ run_cmdstan()
@@ -1641,7 +1641,7 @@ laplace <- function(data = NULL,
16411641 draws = NULL ,
16421642 show_messages = TRUE ,
16431643 show_exceptions = TRUE ,
1644- save_cmdstan_config = TRUE ) {
1644+ save_cmdstan_config = ifelse(cmdstan_version() > " 2.34.0 " , TRUE , NULL ) ) {
16451645 if (cmdstan_version() < " 2.32" ) {
16461646 stop(" This method is only available in cmdstan >= 2.32" , call. = FALSE )
16471647 }
@@ -1716,7 +1716,7 @@ laplace <- function(data = NULL,
17161716 sig_figs = sig_figs ,
17171717 opencl_ids = assert_valid_opencl(opencl_ids , self $ cpp_options()),
17181718 model_variables = model_variables ,
1719- save_cmdstan_config = if (cmdstan_version() > " 2.34.0 " ) save_cmdstan_config
1719+ save_cmdstan_config = save_cmdstan_config
17201720 )
17211721 runset <- CmdStanRun $ new(args , procs )
17221722 runset $ run_cmdstan()
@@ -1797,7 +1797,7 @@ variational <- function(data = NULL,
17971797 draws = NULL ,
17981798 show_messages = TRUE ,
17991799 show_exceptions = TRUE ,
1800- save_cmdstan_config = TRUE ) {
1800+ save_cmdstan_config = ifelse(cmdstan_version() > " 2.34.0 " , TRUE , NULL ) ) {
18011801 procs <- CmdStanProcs $ new(
18021802 num_procs = 1 ,
18031803 show_stderr_messages = show_exceptions ,
@@ -1839,7 +1839,7 @@ variational <- function(data = NULL,
18391839 sig_figs = sig_figs ,
18401840 opencl_ids = assert_valid_opencl(opencl_ids , self $ cpp_options()),
18411841 model_variables = model_variables ,
1842- save_cmdstan_config = if (cmdstan_version() > " 2.34.0 " ) save_cmdstan_config
1842+ save_cmdstan_config = save_cmdstan_config
18431843 )
18441844 runset <- CmdStanRun $ new(args , procs )
18451845 runset $ run_cmdstan()
@@ -1942,7 +1942,7 @@ pathfinder <- function(data = NULL,
19421942 calculate_lp = NULL ,
19431943 show_messages = TRUE ,
19441944 show_exceptions = TRUE ,
1945- save_cmdstan_config = TRUE ) {
1945+ save_cmdstan_config = ifelse(cmdstan_version() > " 2.34.0 " , TRUE , NULL ) ) {
19461946 procs <- CmdStanProcs $ new(
19471947 num_procs = 1 ,
19481948 show_stderr_messages = show_exceptions ,
@@ -1990,7 +1990,7 @@ pathfinder <- function(data = NULL,
19901990 opencl_ids = assert_valid_opencl(opencl_ids , self $ cpp_options()),
19911991 model_variables = model_variables ,
19921992 num_threads = num_threads ,
1993- save_cmdstan_config = if (cmdstan_version() > " 2.34.0 " ) save_cmdstan_config
1993+ save_cmdstan_config = save_cmdstan_config
19941994 )
19951995 runset <- CmdStanRun $ new(args , procs )
19961996 runset $ run_cmdstan()
0 commit comments