Learn R Programming

listarrays (version 0.3.1)

set_as_rows: Reshape an array to send a dimension forward or back

Description

Reshape an array to send a dimension forward or back

Usage

set_as_rows(X, which_dim)

set_as_cols(X, which_dim)

Arguments

X

an array

which_dim

scalar integer or string, which dim to bring forward. Negative numbers count from the back

This is a powered by base::aperm().

Value

a reshaped array

See Also

base::aperm() set_dim() keras::array_reshape()

Examples

Run this code
# NOT RUN {
x <- array(1:24, 2:4)
y <- set_as_rows(x, 3)

for (i in seq_along_dim(x, 3))
  stopifnot( identical(x[,,i], y[i,,]) )
# }

Run the code above in your browser using DataLab