Open alexander-pastukhov opened 3 years ago
I just came over here to post a ?related? bug and a fix I found - and lo-and-behold, your issue was at the top of the list.
I was having trouble with a similar error message when I only sent in a single data point to a model that was written to accomodate multiple data points. It seems that there is something funny about how R handles vectors/arrays/etc..
I found the following fix on the Stan page, and it worked for me: https://github.com/stan-dev/rstan/issues/56
Perhaps enclosing your command in an "as.array(c(.))" will work? It forces the data type to something Stan seems to understand better.
Perhaps enclosing your command in an "as.array(c(.))" will work? It forces the data type to something Stan seems to understand better.
Yes it does. Sorry, I should have mentioned the workaround when posting, my bad! You do not even need the as.array()
just c()
to convert it to an atomic vector.
R 4.0.5, rethinking 2.13, cmdstanr 0.3.0.
How to replicate the problem (see also code below):
scale()
function,d[1:9, ]
ord[-10, ]
)Compilation works if step #2 is skipped. The only difference I've found so far, is that slicing removes
scaled:center
andscaled:scale
, and hiddencdr
attributes (the latter is set toNULL
).UPDATE / WORKAROUND: converting output of
scale()
to an atomic vector, e.g., usingc(scale(...))
on step #1 makes everything work.If you do step #2, Stan throws an error:
The code that works as in the book
These are code chunks 11.36, 11.37, and 11.45
The code that breaks the compilation