I'm trying to remove a layer of an array that contains all zeros. Here's an example:
ii = c(25, 9, 0, 6, 19, 30, 13, 27, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 15, 7, 0, 18, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 0, 43, 33, 40, 34, 42)
key = array(ii,dim=c(3,3,5))
The end result would be equivalent to key[,,-c(2,4)]
or key[,,c(1,3,5)]
. I saw this question but it can only do one row or column. Is there a way to do an entire layer?
Thanks!