pour | R Documentation |
potions::brew()
This is the main function that most users will call on. It retrieves data
from a potions
object stored using brew()
. The UI for this function is
based on the here
package, in that it uses list names separated by commas
to navigate through nested content. It differs from here
in not requiring
those names to be quoted.
pour(..., .slot, .pkg)
pour_package(..., .pkg)
pour_interactive(..., .slot)
pour_all()
... |
string: what slots should be returned |
.slot |
string: Optional manual override to default slot |
.pkg |
string: Optional manual override to default package |
Providing multiple arguments to ...
brings back nested values,
i.e. pour("x", "y")
is for the case of an object structured as
list(x = list(y = 1))
, rather than list(x = 1, y = 2)
. For the latter
case it would be necessary to call with either no arguments
(unlist(pour())
), or for greater control, call pour multiple times
specifying different entries each time (e.g. z <- c(pour("x"), pour("y"))
).
Additional functions are provided in case greater specificity is required.
pour_interactive(.slot = ...)
is synonymous with pour(.slot = ...)
, while
pour_package(.pkg = ...)
is synonymous with pour(.pkg = ...)
.
pour_all()
is a shortcut for getOption("potions-pkg")
; i.e. to show all
data stored using potions
by any package or slot, and does not accept any
arguments.
If no arguments are passed to ...
, returns a list
from the
default slot. If ...
is supplied (correctly), then returns a vector
of
values matching those names.
# first import some data
brew(x = 1, y = list(a = 2, b = 3))
# get all data
pour()
# get only data from slot x
pour("x")
# get nested data
pour("y", "a")
# optional clean-up
drain()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.