- Modern R Programming Cookbook
- Jaynal Abedin
- 168字
- 2021-07-08 09:48:33
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]
- Mastering Ext JS(Second Edition)
- Implementing Modern DevOps
- 從零開始:數字圖像處理的編程基礎與應用
- Vue.js前端開發基礎與項目實戰
- Apache Hive Essentials
- MATLAB應用與實驗教程
- 微信公眾平臺開發:從零基礎到ThinkPHP5高性能框架實踐
- 基于Swift語言的iOS App 商業實戰教程
- C/C++程序員面試指南
- Service Mesh實戰:基于Linkerd和Kubernetes的微服務實踐
- Kotlin開發教程(全2冊)
- Python程序設計與算法基礎教程(第2版)(微課版)
- Hands-On GUI Programming with C++ and Qt5
- IBM Cognos TM1 Developer's Certification guide
- Go語言入門經典