5
I have a three-dimensional array and within that array there is another array of zeros and I want to remove it from the larger array. For example,
set.seed(1)
a = rnorm(60)
b = array(a, dim = c(10, 2, 5))
b[, , 4] = matrix(rep(0, 20), ncol = 2)
b[, , 2] = matrix(rep(0, 20), ncol = 2)
The result I want is an array with
a[ , ,1], a[ , ,3], a[ , ,5]
, that is, by removing
a[ , ,2]
and a[ , ,4]