| variables<- | R Documentation |
draws objectsSet variable names for all variables in a draws object. The
set_variables() form is useful when using pipe operators.
variables(x, ...) <- value
## S3 replacement method for class 'draws_matrix'
variables(x, with_indices = TRUE, ...) <- value
## S3 replacement method for class 'draws_array'
variables(x, with_indices = TRUE, ...) <- value
## S3 replacement method for class 'draws_df'
variables(x, with_indices = TRUE, ...) <- value
## S3 replacement method for class 'draws_list'
variables(x, with_indices = TRUE, ...) <- value
## S3 replacement method for class 'draws_rvars'
variables(x, with_indices = FALSE, ...) <- value
set_variables(x, variables, ...)
x |
(draws) A |
... |
Arguments passed to individual methods (if applicable). |
value, variables |
(character vector) new variable names. |
with_indices |
(logical) Should indices be included in variable
names? For example, if the object includes variables named |
variables(x) <- value allows you to modify the vector of variable names,
similar to how names(x) <- value works for vectors and lists. For renaming
specific variables, set_variables(x, value) works equivalently, but is more intuitive
when using the pipe operator.
For renaming specific variables, rename_variables() may offer a more
convenient approach.
Returns a draws object of the same format as x, with
variables named as specified.
variables, rename_variables, draws-index
x <- example_draws()
variables(x)
nvariables(x)
variables(x) <- letters[1:nvariables(x)]
# or equivalently...
x <- set_variables(x, letters[1:nvariables(x)])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.