x <- c(11, 12, 21, 22, 31, 32)
x <- 1:8

rows <- 4
cols <- 2
depth <- 3
byrows <- TRUE

a <- .01 + x
b <- .02 + x
c <- .03 + x

a <- matrix(a, nrow=rows, ncol=cols, byrows)
b <- matrix(b, nrow=rows, ncol=cols, byrows)
c <- matrix(c, nrow=rows, ncol=cols, byrows)


dims <- c(rows, cols, depth)
arr <- array(c(a,b,c), dims)

##  ---  DONE CREATING arr  ----- ##
####################################



# display arr, and then its individual elements
arr
for (i in 1:length(arr)) { 
  cat("\t\n", arr[i])
}
##--------------------------------------------


## Create the Matrix

# the dimensions of the matirx will be 
#    matrix cols =  the depth of the array
#    matrix rows =  the rows*cols of a single level in the array
dimArr <- dim(arr)
matrRows <- dimArr[1] * dimArr[2]
matrCols <- dimArr[3]


## NOTE:  method1 IS APPROX 20% FASTER THAN method2

# method 1
    mat1 <- arr
    dim(mat1) <- c(matrRows, matrCols)

# method 2
    mat2 <- matrix(arr, matrRows, matrCols)


