flatten {ramify}R Documentation

Flatten Matrices/Arrays

Description

Flatten (i.e., collapse) a matrix or array to one dimension.

Usage

flatten(x, across = c("rows", "columns"))

Arguments

x

A matrix object.

across

Character string specifying whether to flatten the matrix across "rows" (default) or "columns". This option is ignored for multi-way arrays.

Value

A numeric vector.

See Also

mat.

Examples

m <- mat("2, 4, 6, 8; 10, 12, 14, 16")
flatten(m)
flatten(m, across = "columns")

[Package ramify version 0.3.3 Index]