October 2017
Beginner to intermediate
236 pages
7h 38m
English
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))
You can also easily change the layout of the array by simply changing the dimension as follows:
dim(arrayA) <- c(2,4,2)