- Modern R Programming Cookbook
- Jaynal Abedin
- 118字
- 2021-07-08 09:48:33
There's more…
You can give a name to each dimension of an array using the optional argument dim names inside the array() function. For example, take a look at the following code snippet:
column.names <- c("COL1","COL2")
row.names <- c("ROW1","ROW2")
matrix.names <- c("m1","m2", "m3", "m4")
arrayB <- array(1:16, dim=c(2,2,4), dimnames =list(row.names,
column.names, matrix.names))
The dimension of the matrices inside an array should be the same and the data type must be the same as well.
You can also easily change the layout of the array by simply changing the dimension as follows:
dim(arrayA) <- c(2,4,2)
The multiplication of all dimensions (2 x 4 x 2) should be the same as the total number of elements in the array.
推薦閱讀
- Node.js Design Patterns
- ASP.NET Core 5.0開發入門與實戰
- Podman實戰
- 概率成形編碼調制技術理論及應用
- 青少年Python編程入門
- 深入淺出PostgreSQL
- Protocol-Oriented Programming with Swift
- 大數據分析與應用實戰:統計機器學習之數據導向編程
- OpenCV Android開發實戰
- Oracle Database XE 11gR2 Jump Start Guide
- Functional Python Programming
- INSTANT Apache Hive Essentials How-to
- ROS機器人編程實戰
- Head First Kotlin程序設計
- Python Penetration Testing Essentials