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

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]
主站蜘蛛池模板: 宁晋县| 永清县| 宣武区| 丘北县| 女性| 郑州市| 宜城市| 江川县| 通江县| 阿合奇县| 晋中市| 永吉县| 清原| 古交市| 瓦房店市| 海伦市| 灌南县| 湖州市| 马公市| 神池县| 巴林右旗| 新安县| 贵德县| 连南| 随州市| 昆山市| 通辽市| 连州市| 鄂伦春自治旗| 高清| 宜州市| 阳原县| 仪征市| 晋宁县| 襄汾县| 鹤峰县| 隆子县| 溆浦县| 桑日县| 普陀区| 茌平县|