VarBundle: Create bundle of variables.

Description Usage Arguments Value Examples

Description

VarBundle objects store read-only variables in a list-like structure. Variable values can be accessed via the '$' operator (vb$foobar) or via field name(vb[["foobar"]]). After a VarBundle object has been created, new fields cannot be added and existing field values cannot be modified.

Field names can be accessed via field_names.

Simple VarBundle objects that only contain atomic, scalar values are useful for storing configuration information. The object method $as.data.frame() will return a data.frame version of the VarBundle. This can be persisted to disk and subsequently modified by the end user to change system parameters.

Usage

1

Arguments

x

(list or data.frame)

Value

(VarBundle)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Access via $
sales <- varbundle(list(min = 1, max = 10))
sales$min

# Access via name
my_var <- field_names(sales)[1]
sales[[my_var]]

# Create data.frame
df <- sales$as.data.frame()

# Create VarBundle from data.frame
corp_sales <- varbundle(df)
class(corp_sales)

VarBundle documentation built on May 2, 2019, 9:24 a.m.