Re: [Rd] Use of `[` with array and resulting class

2023-09-29 Thread Steve Martin
This is due to `[` dropping dimensions by default. In your first example, think of a[1, , ] as having dimension c(1, 3, 2), but, because drop = TRUE, all dimensions of extent 1 (the first dimension) are dropped and the result has dimension c(3, 2). In your second example, b[1, , ] would have dimens

[Rd] Use of `[` with array and resulting class

2023-09-29 Thread Joseph Wood
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] [1,]456 class(a) [1] "array" dim(a)