R Array
Array
An Array is the R data object that can store data in more than two dimensions
CODE/PROGRAM/EXAMPLE
str(array)
function (data = NA, dim = length(data), dimnames = NULL)
- data: the data to create an array
- dim: the dimensions of the array
- dimnames: the row & column names
Syntax
ary <- array(data = 1:24, dim = c(3,4,2))
print(ary)
Output:
In the example shown, dim=c(3,4,2) represents 3 rows, 4 columns and data to be divided into 2 arrays