set_dimnames_for_rank.Rd
Sets the dimensions names for a particular rank, without requiring dimnames for the other ranks.
set_dimnames_for_rank(x, rank, ..., .dots = NULL)
input tidytensor to set dimnames on.
rank to set the dimnames on.
dimnames to assign (quoted or unquoted).
character vector of dimnames to assign (quoted or unquoted).
a tidytensor with dimnames set.
If all dimnames are unset, they will be set to NA for the other ranks, otherwise they will be left alone.
ranknames<-
, dimnames
, set_dimnames
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
#> | # ...