View source: R/teal_data-constructor.R
teal_data | R Documentation |
teal
applicationsInitializes a data for teal
application.
teal_data(..., join_keys = teal.data::join_keys(), code = character(0))
## S3 method for class 'teal_data'
x[names]
... |
any number of objects (presumably data objects) provided as |
join_keys |
( |
code |
( Use |
x |
( |
names |
( |
A teal_data
is meant to be used for reproducibility purposes. The class inherits from
teal.code::qenv
and we encourage to get familiar with teal.code first.
teal_data
has following characteristics:
It inherits from the environment and methods such as $
, get()
, ls()
, as.list()
,
parent.env()
work out of the box.
teal_data
is a locked environment, and data modification is only possible through the
teal.code::eval_code()
and within.qenv()
functions.
It stores metadata about the code used to create the data (see get_code()
).
It supports slicing (see teal.code::subset-qenv
)
Is immutable which means that each code evaluation does not modify the original teal_data
environment directly.
It maintains information about relationships between datasets (see join_keys()
).
A teal_data
object.
x[names]
subsets objects in teal_data
environment and limit the code to the necessary needed to build limited
objects.
teal.code::eval_code
, get_code()
, join_keys()
, names.teal_data()
teal_data(x1 = iris, x2 = mtcars)
# Subsetting
data <- teal_data()
data <- eval_code(data, "a <- 1;b<-2")
data["a"]
data[c("a", "b")]
join_keys(data) <- join_keys(join_key("a", "b", "x"))
join_keys(data["a"]) # should show empty keys
join_keys(data["b"])
join_keys(data)["a"] # should show empty keys
join_keys(data)["b"]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.