Save output and data files — CmdStanFit-method-save_output_files • cmdstanr
Description: All fitted model objects have methods save_output_files() and save_data_file(). These methods move csv output files and R dump or json data files from the CmdStanR temporary directory to a user-specified location. By default the suffix '-&lt;run_id&gt;_&lt;timestamp&gt;' is added to the file name(s), where run_id is the chain number if applicable (MCMC only) and 1 otherwise. If files with the specified names already exist they are overwritten, but this shouldn't occur unless the timestamp argument has been intentionally set to FALSE.

# Save output and data files

`CmdStanFit-method-save_output_files.Rd`

All fitted model objects have methods `save_output_files()` and `save_data_file()`. These methods move csv output files and R dump or json data files from the CmdStanR temporary directory to a user-specified location. By default the suffix `'-<run_id>_<timestamp>'` is added to the file name(s), where `run_id` is the chain number if applicable (MCMC only) and `1` otherwise. If files with the specified names already exist they are overwritten, but this shouldn't occur unless the `timestamp` argument has been intentionally set to `FALSE`.

## Usage

    $save_output_files(dir = ".", basename = NULL, timestamp = TRUE)
    $save_data_file(dir = ".", basename = NULL, timestamp = TRUE)

## Arguments

`save_output_files()` and `save_data_file()` have the same arguments:

- `dir`: (string) Path to directory where the files should be saved.

- `basename`: (string) Base filename to use.

- `timestamp`: (logical) Should a timestamp be added to the file name(s)? Defaults to `TRUE`. The timestamp is preceeded by an underscore is of the form

## Value

The paths to the new files or `NA` for any that couldn't be copied.

## See also

`CmdStanMCMC`, `CmdStanMLE`, `CmdStanVB`