-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
data = list() causes expecting JSON error #401
Comments
Thanks. This is because For cmdstan to work it should be an empty file, no file or jsonlite::write_json(
list(),
path = file,
auto_unbox = TRUE,
factor = "integer",
digits = NA,
pretty = TRUE
) stores |
@bob-carpenter I think the code you shared is actually the code that runs fine, not the code that produces the warning because you included # this code you had doesn't result in the error/warning you showed below it
fit <- m$sample(data = list(a = 5),
chains = 1, threads_per_chain = 1,
iter_warmup = 100, iter_sampling = 100) But if I go ahead and change your example to use I think I just assumed that if a model had no data the data argument would be omitted (which works fine), but I definitely agree that it should still work if it's specified as an empty list. Should be an easy fix (@rok-cesnovar we can just immediately convert an empty list to |
Agree. |
Yup. My bad. I meant |
Ok yeah I can definitely fix that today. Thanks for pointing it out. |
Ok this should be fixed by #403 as soon as it's merged. Thanks again for reporting this. |
Describe the bug
Empty data list causes JSON error.
To Reproduce
race.stan:
race.R:
In R:
If I change the data line in the script to
data = list(a = 1)
for a non-existent data item then it runs just fine.Expected behavior
It treats an empty list as an empty list rather than trying to convert to JSON.
Operating system
The text was updated successfully, but these errors were encountered: