Às 17:33 de 29/09/2023, Joseph Wood escreveu:
Hello,
I recently discovered a possible inconsistency with usage of an object of
class array.
Consider the following example:
## Setup
a <- array(1:6, dim = c(1, 3, 2))
a
, , 1
[,1] [,2] [,3]
[1,]123
, , 2
[,1] [,2] [,3]
Hi Joseph
This behaviour is as expected (and as documented by ?`[`) because the default
of drop=TRUE coerces the result to the lowest possible dimension, which in your
case is a vector rather than array. Using for example:
b[1,,,drop=FALSE]
... results in an output array with the same number