It appears that cmdstanR will not work if stan files have a space in the name. Here I’m using the famous 8 schools example to illlustrate the issue. Saving the model file as schools.stan works exactly as expected. Saving it as “schools with space.stan” does not and returns Error: Supplied CSV file is corrupt!:
> file <- "examples/schools with space.stan"
> mod_sch <- cmdstan_model(file)
> fit_mcmc <- mod_sch$sample(data = schools_dat, seed = 123, chains = 2, parallel_chains = 2)
Running MCMC with 2 parallel chains...
<removed chain status updates for brevity>
Chain 1 finished in 0.1 seconds.
Chain 2 finished in 0.1 seconds.
Both chains finished successfully.
Mean chain execution time: 0.1 seconds.
Total execution time: 0.2 seconds.
grep: /tmp/RtmpYguSPm/schools: No such file or directory
grep: with: No such file or directory
grep: space-202102091644-1-5c8e67.csv: No such file or directory
Error: Supplied CSV file is corrupt!
> fit_mcmc$output_files()
Error: object 'fit_mcmc' not found
/tmp/RtmpYguSPm/‘schools with space-202102091644-1-5c8e67.csv’ does exist in my file system.
Running cmdstanr 0.3.0 with cmdstan 2.26.0