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

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]
主站蜘蛛池模板: 金昌市| 康马县| 游戏| 闻喜县| 元朗区| 合作市| 克什克腾旗| 金湖县| 杨浦区| 赣榆县| 鹿泉市| 迁安市| 华坪县| 黄冈市| 将乐县| 康保县| 信阳市| 中阳县| 八宿县| 米林县| 南溪县| 清河县| 乾安县| 怀宁县| 石嘴山市| 遵义市| 江城| 夏邑县| 仁化县| 山丹县| 藁城市| 绥中县| 商都县| 阿拉尔市| 河池市| 临高县| 井陉县| 天气| 呼伦贝尔市| 如皋市| 淮南市|