官术网_书友最值得收藏!

How to do it…

The simplest way to create an array is to use the array() function from R and then specify the elements and the dimension as shown in the following code snippet:

        arrayA <- array(1:16, dim=c(2,2,4))

The preceding function will produce an array of four matrices of order 2 x 2. By default, it will create the columns of the matrices and place them next to each other. The output of an array looks like this:

        > arrayA
, , 1

[,1] [,2]
[1,] 1 3
[2,] 2 4

, , 2

[,1] [,2]
[1,] 5 7
[2,] 6 8

, , 3

[,1] [,2]
[1,] 9 11
[2,] 10 12

, , 4

[,1] [,2]
[1,] 13 15
[2,] 14 16
主站蜘蛛池模板: 清水河县| 长岛县| 大连市| 大余县| 石景山区| 盐亭县| 定陶县| 茌平县| 遂溪县| 日土县| 图们市| 萨迦县| 林口县| 吉安县| 长岭县| 乌拉特前旗| 白水县| 盱眙县| 河曲县| 子长县| 棋牌| 祁连县| 房产| 克山县| 淮滨县| 平陆县| 敦化市| 花莲市| 呼玛县| 安宁市| 晋城| 广德县| 恩施市| 伊通| 武鸣县| 双牌县| 布拖县| 临朐县| 梁河县| 金湖县| 柳州市|