set_variables {posterior} | R 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 |
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)
x <- set_variables(x, c("theta[1]", "theta[2]"))
variables(x)
# this is equivalent to
variables(x) <- c("theta[1]", "theta[2]")
variables(x)
[Package posterior version 1.5.0 Index]