Sets the dimensions names for a particular rank, without requiring dimnames for the other ranks.

set_dimnames_for_rank(x, rank, ..., .dots = NULL)

Arguments

x

input tidytensor to set dimnames on.

rank

rank to set the dimnames on.

...

dimnames to assign (quoted or unquoted).

.dots

character vector of dimnames to assign (quoted or unquoted).

Value

a tidytensor with dimnames set.

Details

If all dimnames are unset, they will be set to NA for the other ranks, otherwise they will be left alone.

See also

ranknames<-, dimnames, set_dimnames

Examples

t <- as.tidytensor(array(1:(3 * 2), dim = c(3, 2)))
t <- set_dimnames_for_rank(t, 2, valset1, valset2)
t <- set_dimnames_for_rank(t, 2, .dots = c("valset1", "valset2"))
print(t)
#> # Rank 2 tensor, shape: (3, 2)
#> |  # Rank 1 tensor, shape: (2)
#> |      1  4 
#> |  # ...