
上QQ阅读APP看书,第一时间看更新
How to do it...
Perform the following steps to create and see an array in R:
> t = array(c(1,2,3,4), dim=c(2,2)) # Create two dimensional array > t Output: [,1] [,2]
[1,] 1 3
[2,] 2 4 > arr = array(c(1:24), dim=c(3,4,2)) # Creating three dimensional array > arr Output: , , 1
[,1] [,2] [,3] [,4]
[1,] 1 4 7 10
[2,] 2 5 8 11
[3,] 3 6 9 12
, , 2
[,1] [,2] [,3] [,4]
[1,] 13 16 19 22
[2,] 14 17 20 23 [3,] 15 18 21 24