Hi,
stan function is
foo(array[] vector X)
where X is R data.frame. How to pass X correctly from R to stan?
Thanks for any help.
It looks like you’ve declared X to be an array of vectors. Do you mean that you want to use an R data frame inside your Stan program? Unfortunately that won’t be possible because there’s no concept of an R data frame in the Stan programming language (Stan doesn’t know about R data types or Python data types, only Stan data types). Or did you mean something different? If you can convert your data frame to a matrix in R then you can pass that to Stan and declare X
to be a matrix. Or I believe an array of vectors can also be passed in from R as a list of vectors, if I recall correctly.
For example, if you have an array[2] vector[3] X
then in R you could have
X <- list(runif(3), runif(3))
That is, X has two elements, each of which is a vector of size 3.