- 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]
- 圖解Java數據結構與算法(微課視頻版)
- JMeter 性能測試實戰(第2版)
- Reactive Programming with Swift
- 實戰低代碼
- Python程序設計案例教程
- Python機器學習編程與實戰
- 你不知道的JavaScript(中卷)
- 程序是怎樣跑起來的(第3版)
- H5頁面設計:Mugeda版(微課版)
- Getting Started with Greenplum for Big Data Analytics
- Python算法詳解
- Visual Basic程序設計教程
- Application Development with Parse using iOS SDK
- JavaWeb從入門到精通(視頻實戰版)
- Python數據可視化之matplotlib實踐