- 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.
推薦閱讀
- Getting Started with Gulp(Second Edition)
- 企業(yè)級Java EE架構(gòu)設(shè)計精深實踐
- 零基礎(chǔ)學(xué)Python網(wǎng)絡(luò)爬蟲案例實戰(zhàn)全流程詳解(入門與提高篇)
- MATLAB 2020從入門到精通
- Learning Concurrent Programming in Scala
- Mobile Device Exploitation Cookbook
- 計算機應(yīng)用基礎(chǔ)項目化教程
- Programming Microsoft Dynamics? NAV 2015
- C指針原理揭秘:基于底層實現(xiàn)機制
- 大數(shù)據(jù)時代的企業(yè)升級之道(全3冊)
- 深度學(xué)習(xí)入門:基于Python的理論與實現(xiàn)
- JavaScript編程精解(原書第2版)
- Learning Dynamics NAV Patterns
- Java EE 程序設(shè)計
- Office VBA開發(fā)經(jīng)典:中級進階卷