powered by
Change shape and size of a matrix or array.
resize(x, nrow, ncol, ..., across = c("rows", "columns"), byrow = FALSE)
A matrix with dimension nrow-by-ncol.
nrow
ncol
A matrix or multi-way array.
The desired number of rows.
The desired number of columns.
Further dimensions of the array.
Character string specifying whether to flatten the matrix across "rows" (default) or "columns". This option is ignored for multi-way arrays.
"rows"
"columns"
Logical. If FALSE (default) the new matrix is filled by columns, otherwise it is filled by rows. This option is ignored for multi-way arrays.
flatten, mat, matrix.
flatten
mat
matrix
m <- 1:9 resize(m) resize(m, 3, 3) resize(m, 2, 2)
Run the code above in your browser using DataLab