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

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]
主站蜘蛛池模板: 随州市| 连山| 黄浦区| 弥渡县| 万宁市| 通渭县| 田阳县| 南陵县| 嫩江县| 叶城县| 施秉县| 城口县| 四子王旗| 永德县| 昌乐县| 慈利县| 满洲里市| 华容县| 同仁县| 卢氏县| 保定市| 洪雅县| 广昌县| 榆林市| 六枝特区| 东乌珠穆沁旗| 西安市| 密山市| 栖霞市| 济宁市| 临汾市| 宝山区| 盱眙县| 平阴县| 炎陵县| 确山县| 息烽县| 察雅县| 洱源县| 宜章县| 延津县|