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

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]
主站蜘蛛池模板: 碌曲县| 荆门市| 拉萨市| 教育| 镇安县| 汝阳县| 云林县| 拉孜县| 宿迁市| 胶州市| 霞浦县| 瓦房店市| 呼伦贝尔市| 莎车县| 象州县| 平泉县| 大石桥市| 延长县| 舟山市| 乌鲁木齐县| 崇信县| 视频| 和田市| 霞浦县| 兴仁县| 翁牛特旗| 濮阳市| 宣恩县| 枝江市| 商河县| 肃宁县| 湘乡市| 株洲市| 循化| 板桥市| 特克斯县| 遂平县| 丹阳市| 加查县| 慈利县| 辽中县|