variables {posterior} | R Documentation |
Get variable names from draws
objects
Description
Get variable names from draws
objects.
Usage
variables(x, ...)
## S3 method for class 'draws_matrix'
variables(x, reserved = FALSE, with_indices = TRUE, ...)
## S3 method for class 'draws_array'
variables(x, reserved = FALSE, with_indices = TRUE, ...)
## S3 method for class 'draws_df'
variables(x, reserved = FALSE, with_indices = TRUE, ...)
## S3 method for class 'draws_list'
variables(x, reserved = FALSE, with_indices = TRUE, ...)
## S3 method for class 'draws_rvars'
variables(x, reserved = FALSE, with_indices = FALSE, ...)
nvariables(x, ...)
Arguments
x |
(draws) A |
... |
Arguments passed to individual methods (if applicable). |
reserved |
(logical) Should reserved variables be included in the
output? Defaults to |
with_indices |
(logical) Should indices be included in variable
names? For example, if the object includes variables named |
Details
variables()
returns a vector of all variable names, and nvariables()
returns the number of variables.
Value
For variables()
, a character vector.
For nvariables()
, a scalar integer.
See Also
variables<-
, rename_variables
, draws-index
Examples
x <- example_draws()
variables(x)
nvariables(x)
variables(x) <- letters[1:nvariables(x)]