|
20 | 20 | #' The `list` to `array` conversion is intended to make it easier to prepare |
21 | 21 | #' the data for certain Stan declarations involving arrays: |
22 | 22 | #' |
23 | | -#' * `vector[J] v[K]` (or equivalently `array[K] vector[J] v ` as of Stan 2.27) |
24 | | -#' can be constructed in \R as a list with `K` elements where each element a |
25 | | -#' vector of length `J` |
26 | | -#' * `matrix[I,J] v[K]` (or equivalently `array[K] matrix[I,J] m ` as of Stan |
27 | | -#' 2.27 ) can be constructed in \R as a list with `K` elements where each element |
28 | | -#' an `IxJ` matrix |
| 23 | +#' * `array[K] vector[J] v ` can be constructed in \R as a list with `K` |
| 24 | +#' elements where each element a vector of length `J` |
| 25 | +#' * `array[K] matrix[I,J] m ` can be constructed in \R as a list with `K` |
| 26 | +#' elements where each element an `IxJ` matrix |
29 | 27 | #' |
30 | 28 | #' These can also be passed in from \R as arrays instead of lists but the list |
31 | 29 | #' option is provided for convenience. Unfortunately for arrays with more than |
32 | | -#' one dimension, e.g., `vector[J] v[K,L]` (or equivalently |
33 | | -#' `array[K,L] vector[J] v ` as of Stan 2.27) it is not possible to use an \R |
34 | | -#' list and an array must be used instead. For this example the array in \R |
| 30 | +#' one dimension (e.g. `array[K,L] vector[J] v `) it is not possible to use an |
| 31 | +#' \R list and an array must be used instead. For this example the array in \R |
35 | 32 | #' should have dimensions `KxLxJ`. |
36 | 33 | #' |
37 | 34 | #' @examples |
|
49 | 46 | #' |
50 | 47 | #' |
51 | 48 | #' # demonstrating list to array conversion |
52 | | -#' # suppose x is declared as `vector[3] x[2]` (or equivalently `array[2] vector[3] x`) |
| 49 | +#' # suppose x is declared as `array[2] vector[3] x` |
53 | 50 | #' # we can use a list of length 2 where each element is a vector of length 3 |
54 | 51 | #' data <- list(x = list(1:3, 4:6)) |
55 | 52 | #' file <- tempfile(fileext = ".json") |
@@ -159,14 +156,6 @@ process_data <- function(data, model_variables = NULL) { |
159 | 156 | } else if (is.character(data)) { |
160 | 157 | path <- absolute_path(data) |
161 | 158 | } else if (is.list(data) && !is.data.frame(data)) { |
162 | | - if (cmdstan_version() < "2.22" && any_zero_dims(data)) { |
163 | | - stop( |
164 | | - "Data includes 0-dimensional data structures. To use this data please ", |
165 | | - "either update your CmdStan installation with install_cmdstan() ", |
166 | | - "or specify data as a file created by rstan::stan_rdump().", |
167 | | - call. = FALSE |
168 | | - ) |
169 | | - } |
170 | 159 | if (!is.null(model_variables)) { |
171 | 160 | data_variables <- model_variables$data |
172 | 161 | is_data_supplied <- names(data_variables) %in% names(data) |
|
0 commit comments