ranknames: Get ranknames of a tidytensor.

Description Usage Arguments Details Value See Also Examples

Description

A tidytensor t may have ranknames(t); this is a character vector of the same length as dim(t) for future use. Note that ranknames(t) is independent of names(t) or dimnames(t); we are not naming elements, or the dimension names for each rank, but rank names themselves. Like names() and dimnames(), unset ranknames() are NULL.

Usage

1

Arguments

x

input tidytensor to get ranknames for.

...

additional arguments to be passed to or from methods (ignored).

Details

Ranknames for a tidytensor t are stored as the names() attribute of dimnames(t). If dimnames(t) happens to be null, before setting ranknames() we create valid dimnames() filled with NA values. The tidytensor package also provides a specialized dimnames() which preserves ranknames when setting dimnames().

Value

character vector of the same length as dim(x), or NULL if unset.

See Also

set_ranknames, ranknames<-

Examples

1
2
3
t <- as.tidytensor(array(1:(3 * 4 * 5), dim = c(3, 4, 5)))
ranknames(t) <- c("sample", "row", "col")
print(ranknames(t))

oneilsh/tidytensor documentation built on Oct. 11, 2021, 11:43 p.m.