```
if (FALSE) {
# let's construct a 2x2 array from a vector of 4 elements
x <- 1:4
# rearrange will fill the array row-wise
array_reshape(x, c(2, 2))
# [,1] [,2]
# [1,] 1 2
# [2,] 3 4
# setting the dimensions 'fills' the array col-wise
dim(x) <- c(2, 2)
x
# [,1] [,2]
# [1,] 1 3
# [2,] 2 4
}
```

Run the code above in your browser using DataLab