Helper functions for the rvtable class.

rvattr(x, id, all = FALSE)

rvtype(x)

tabletype(x)

is_rvtable(x)

is_sample(x)

is_distribution(x)

is_discrete(x)

is_continuous(x)

is_density(x)

coltypes(x)

valcol(x)

probcol(x)

idcols(x)

get_density_args(x)

get_sample_args(x)

set_density_args(x, density.args)

set_sample_args(x, sample.args)

Arguments

x

rvtable.

id

character, rvtable attribute(s). If not provided, all available rvtable attributes.

all

logical, ignore `id` and return all attributes, including those not specific to the `rvtable` class. Defaults to FALSE.

density.args

set rvtable density arguments. See details.

sample.args

set rvtable sampling arguments. See details.

Value

information about various rvtable attributes. See details.

Details

These helper functions provide information about rvtable class objects and their attributes. They get and in some cases set rvtable attributes as well as perform various logical checks. rvattr returns a named list of attributes of x. is* functions return TRUE or FALSE. rvtype, tabletype, valcol and probcol return individual attributes of x (character).

get* functions for density and sample argument lists return the lists from the attributes of x and the corresponding set* functions return x with the new denisty.args and sample.args attributes. Setting density or sample argument lists is usually done when passing arguments to a function, e.g., rvtable or sample_rvtable. However, it can sometimes be useful to set these directly or update them at a desired step in a rvtable processing pipeline. Note that when defaults are not explicitly provided (i.e., leaving as list() or NULL), the atrributes of an rvtable will still display all sampling default arguments and the most important density default arguments for clarity.

Examples

# NOT RUN {
x <- rvtable(1:10)

is_rvtable(x)
is_sample(x)
is_distribution(x)
is_discrete(x)
is_continuous(x)
is_density(x)

rvattr(x)
rvattr(x, id=c("rvtype", "tabletype"))
rvattr(x, all = TRUE)

rvtype(x)
tabletype(x)
valcol(x)
probcol(x)

get_density_args(x)
get_sample_args(x)
x <- set_density_args(x, list(n = 1000, adjust = 0.1))
x <- set_sample_args(x, list(n = 100))
get_density_args(x)
get_sample_args(x)
# }