Slip 26 - E) Write a script in R to create an array, passing in a vector of values and a vector of dimensions. Also provide names for each dimension.

Solution:

a=array(6:30,
        dim=c(4,3,2),
        dimnames=list(
          c("Col1","Col2","Col3","Col4"),
          c("Row1","Row2","Row3"),
          c("Part1","Part2")))
print(a)

Post a Comment

0 Comments