Return a named vector or matrix.
Examples
my_set <- letters[1:3]
my_parameter <- c(2, 6, 3) |> parameter(my_set)
my_parameter
#> my_set
#> a b c
#> 2 6 3
rows <- letters[1:2]
cols <- LETTERS[1:3]
my_matrix <- c(
1, 2, 3,
4, 5, 6
) |> parameter(rows, cols)
my_matrix
#> cols
#> rows A B C
#> a 1 2 3
#> b 4 5 6
# Also works if .x is already a matrix.
mat <- matrix(1:6, nrow = 3, ncol = 2)
mat |> parameter(r = letters[1:3], c = LETTERS[1:2])
#> c
#> r A B
#> a 1 4
#> b 2 5
#> c 3 6