resize | R Documentation |
Change shape and size of a matrix or array.
resize(x, nrow, ncol, ..., across = c("rows", "columns"), byrow = FALSE)
x |
A matrix or multi-way array. |
nrow |
The desired number of rows. |
ncol |
The desired number of columns. |
... |
Further dimensions of the array. |
across |
Character string specifying whether to flatten the matrix
across |
byrow |
Logical. If |
A matrix with dimension nrow
-by-ncol
.
flatten()
, mat()
, matrix()
.
m <- 1:9
resize(m)
resize(m, 3, 3)
resize(m, 2, 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.