Pass 3D array from R

Hi. Is it possible to pass a 3D array from R into stan? If yes, could you please show me how? Thanks.

In the interfaces rstan and cmdstanr, it’s just passed in as a 3D array. If you want a file format, we prefer JSON now and may deprecate RDump going forward. Here’s the doc for the file format:

It explains, among other things, how you can use cmdstanr to write the data files from a data list, so that might be the easiest way for you to figure things out.

1 Like

I apologize as I actually asked the wrong question. I want to pass an array of matrices:

matrix[I, T] X[P]

How could I create such data in R so that Stan can recognize it correctly? Thanks.