We first create the array and named it by X, as follows:
################
X=array(1:120,dim=c(5,6,4))
################
Now we subset the array X, such that it contains the 2nd and 3rd row; 1,4,6th column and 3,4th layer, as follows:
###########################
x[2:3,c(1,4,6),-c(1,2)]
##################
The output is given below:
########################
, , 1
[,1] [,2] [,3]
[1,] 62 77 87
[2,] 63 78 88
, , 2
[,1] [,2] [,3]
[1,] 92 107 117
[2,] 93 108 118
##################################
Get Answers For Free
Most questions answered within 1 hours.