- 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]
- OpenDaylight Cookbook
- Building a Game with Unity and Blender
- Python數據分析基礎
- Java Web基礎與實例教程(第2版·微課版)
- 人人都是網站分析師:從分析師的視角理解網站和解讀數據
- ASP.NET程序設計教程
- jQuery Mobile移動應用開發實戰(第3版)
- 基于SpringBoot實現:Java分布式中間件開發入門與實戰
- C++20高級編程
- Swift語言實戰晉級
- OpenCV Android Programming By Example
- Julia數據科學應用
- 分布式架構原理與實踐
- Clojure Data Structures and Algorithms Cookbook
- Distributed Computing with Python