draws: Transform to 'draws' objects

Description Usage Arguments Details Value See Also Examples

Description

Try to transform an R object to a format supported by the posterior package.

Usage

1
2
3

Arguments

x

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

...

Arguments passed to individual methods (if applicable).

Details

The class "draws" is the parent class of all supported formats, which also have their own subclasses of the form "draws_{format}" (e.g. "draws_array").

Value

If possible, a draws object in the closest supported format to x. The formats are linked to in the See Also section below.

See Also

Other formats: draws_array(), draws_df(), draws_list(), draws_matrix(), draws_rvars()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# create some random draws
x <- matrix(rnorm(30), nrow = 10)
colnames(x) <- c("a", "b", "c")
str(x)

# transform to a draws object
y <- as_draws(x)
str(y)

# remove the draws classes from the object
class(y) <- class(y)[-(1:2)]
str(y)

posterior documentation built on Sept. 9, 2021, 5:07 p.m.