- 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.
推薦閱讀
- Learn Type:Driven Development
- Oracle Database In-Memory(架構與實踐)
- arc42 by Example
- Cocos2d-x游戲開發:手把手教你Lua語言的編程方法
- 跟小海龜學Python
- Learning ArcGIS for Desktop
- Kotlin從基礎到實戰
- 運用后端技術處理業務邏輯(藍橋杯軟件大賽培訓教材-Java方向)
- Android玩家必備
- 圖數據庫實戰
- MySQL程序員面試筆試寶典
- 深入理解BootLoader
- Java Web開發實例大全(基礎卷) (軟件工程師開發大系)
- Java Web應用開發給力起飛
- Learning Concurrency in Python