Skip to contents

Converts a tensor() to an array() by stripping the index labels. An index label order needs to be provided so that the array's dim() order is well defined.

Usage

as_a(x, ...)

Arguments

x

A labeled array ("tensor" object) created by %_% or tensor().

...

Index labels separated by commas optionally prefixed by "+" and "-" to indicate the index position (upper and lower respectively). If no prefix is provided, a lower index ("-") is assumed. This argument uses non-standard evaluation: any R symbol that is not a reserved keyword can be used. The specification needs to match all the labels occurring in x. The label order determines the dimension ordering of the resulting array.

Value

A usual array() without attached labels. The dimension order is determined by ....

See also

The same functionality is implemented in as.array.tensor() but with standard evaluation.

Examples

array(1:8, dim = c(2, 2, 2)) %_% .(i, +i, k) |> as_a(k)
#> [1]  5 13