Get names of reserved variables from objects in the posterior package.

reserved_variables(x, ...)

# S3 method for default
reserved_variables(x, ...)

# S3 method for draws_matrix
reserved_variables(x, ...)

# S3 method for draws_array
reserved_variables(x, ...)

# S3 method for draws_df
reserved_variables(x, ...)

# S3 method for draws_list
reserved_variables(x, ...)

# S3 method for draws_rvars
reserved_variables(x, ...)

Arguments

x

(draws) A draws object or another R object for which the method is defined.

...

Arguments passed to individual methods (if applicable).

Value

A character vector of reserved variables used in x.

Details

reserved_variables() returns the names of reserved variables in use by an object.

The following variables names are currently reserved for special use cases in all draws formats:

Further, specific for the draws_df format, there are three additional reserved variables:

  • .chain: Chain index per draw

  • .iteration: Iteration index within each chain

  • .draw: Draw index across chains

More reserved variables may be added in the future.

Examples


x <- example_draws()
reserved_variables(x)
#> character(0)

# if we add weights, the `.log_weight` reserved variable is used
x <- weight_draws(x, rexp(ndraws(x)))
reserved_variables(x)
#> [1] ".log_weight"