Array in R
Arrays
can be of any number of dimensions opposed to matrix which is limited to two dimensional. The array function takes a
dim attribute which creates the required number of dimension.
# Command
Prototype
Command::
a <- array(c('vegetable','Fruits'),dim = c(3,3,2))
>
print(a)
,
, 1
[,1]
[,2] [,3]
[1,]
"vegetable" "Fruits"
"vegetable"
[2,]
"Fruits"
"vegetable" "Fruits"
[3,]
"vegetable" "Fruits"
"vegetable"
,
, 2
[,1]
[,2] [,3]
[1,]
"Fruits"
"vegetable" "Fruits"
[2,]
"vegetable" "Fruits"
"vegetable"
[3,]
"Fruits"
"vegetable" "Fruits"
Array in R
Reviewed by Rupesh
on
00:10
Rating:
No comments: