A=array(1:24, dim=c(3,4,2))
print(A[c(1,3),c(2,4),1])
print(A[c(2,3),,2])
print(A[,c(1,4),1])
print(A[-2,-3,2])

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: