set_variables: Set variable names in 'draws' objects

View source: R/draws-index.R

set_variablesR Documentation

Set variable names in draws objects

Description

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

Usage

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

variables

Examples

x <- as_draws(matrix(rnorm(100), ncol = 2))
variables(x)

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

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


posterior documentation built on Nov. 2, 2023, 5:56 p.m.