- 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.
推薦閱讀
- The Complete Rust Programming Reference Guide
- R語言數(shù)據(jù)分析從入門到精通
- Visual Basic程序開發(fā)(學習筆記)
- Groovy for Domain:specific Languages(Second Edition)
- C語言實驗指導及習題解析
- Python 3.7從入門到精通(視頻教學版)
- MATLAB GUI純代碼編寫從入門到實戰(zhàn)
- Clojure for Java Developers
- 工業(yè)機器人離線編程
- 現(xiàn)代C:概念剖析和編程實踐
- Node.js從入門到精通
- PhoneGap 4 Mobile Application Development Cookbook
- C語言程序設計教程
- 可視化H5頁面設計與制作:Mugeda標準教程
- Internet of Things with Arduino Cookbook