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

How it works…

To work in an array, you have to understand how the dimension works. The first and second dimensions in the preceding example specify the dimension of the matrices. Each matrix is element of this array. The third dimension specifies the element number of the array. So, to extract any matrix from this array, you have to specify the position of that matrix by providing the position index using the third dimension. For example, to extract the second matrix from the arrayA object, execute the following code:

    arrayA2 <- arrayA[, , 2]

Since the value for the first and second dimensions is blank, it indicates that all of the elements have to be extracted in that direction. So, in this case, it will extract all rows and all columns of the second matrix from the arrayA object.

If you are interested in getting access to a single element from a second matrix, let's say the first element, then the code will be as follows:

    arrayA[1,1,2]
主站蜘蛛池模板: 新晃| 务川| 贺兰县| 阳信县| 揭西县| 东莞市| 商丘市| 尚志市| 邛崃市| 萝北县| 长春市| 清河县| 竹北市| 施秉县| 赤壁市| 宁波市| 鄂伦春自治旗| 顺义区| 梧州市| 伊金霍洛旗| 静乐县| 库车县| 博罗县| 临湘市| 日土县| 祥云县| 延吉市| 贡觉县| 二连浩特市| 娄烦县| 松滋市| 云林县| 盐源县| 平原县| 讷河市| 新泰市| 凤城市| 兖州市| 巴中市| 织金县| 阳山县|