Section 5 Array

5.1 Function

Example vector: x <- c(1:30)

Function Explanation Example
array Create an array array(data=x, dim=c(5,3,2))
as.array Coerce into an array as.array(x)
is.array Check if its argument is an array is.array(x)
dim Get the dimension of an array dim(x)
dimnames A dimnames attribute for the array, NULL or a list with one component for each dimension dimnames(x)
attributes Attributes of an array attributes(x)


Array


5.2 Example

?array

x <- c(1:30)
y <- array(data=x, dim=c(5,3,2))

y
is.array(y)
dim(y)
dimnames(y)

dimnames(y) <- list(LETTERS[1:5], letters[1:3], c('G1','G2'))
y

dimnames(y)
attributes(y)