Set variable names for all variables in a draws object. Useful when using pipe operators.

set_variables(x, variables, ...)

Arguments

x

(draws) A draws object.

variables

(character) new variable names.

...

Arguments passed to individual methods (if applicable).

Value

Returns a draws object of the same format as x, with variables named as specified.

See also

Examples

x <- as_draws(matrix(rnorm(100), ncol = 2))
variables(x)
#> [1] "...1" "...2"

x <- set_variables(x, c("theta[1]", "theta[2]"))
variables(x)
#> [1] "theta[1]" "theta[2]"

# this is equivalent to
variables(x) <- c("theta[1]", "theta[2]")
variables(x)
#> [1] "theta[1]" "theta[2]"