powered by
Flatten (i.e., collapse) a matrix or array to one dimension.
flatten(x, across = c("rows", "columns"))
A numeric vector.
A matrix.
Character string specifying whether to flatten the matrix across "rows" (default) or "columns". This option is ignored for multi-way arrays.
"rows"
"columns"
mat.
m <- mat("2, 4, 6, 8; 10, 12, 14, 16") flatten(m) flatten(m, across = "columns")
Run the code above in your browser using DataLab