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

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]
主站蜘蛛池模板: 临沭县| 綦江县| 新干县| 凤冈县| 巍山| 夏邑县| 嘉兴市| 沁源县| 陕西省| 长汀县| 湘潭县| 明光市| 隆子县| 东方市| 德清县| 田林县| 滦南县| 仁怀市| 肃北| 大港区| 诸城市| 博乐市| 江山市| 太和县| 余江县| 濉溪县| 辉县市| 原阳县| 威远县| 阿坝县| 高台县| 鄂托克前旗| 洪湖市| 桓台县| 武乡县| 富蕴县| 贡觉县| 岚皋县| 白朗县| 安福县| 宣恩县|