as.data.frame.yamlet | R Documentation |
Coerces yamlet to data.frame. Columns are constructed in the order that
attributes are encountered, beginning with top-level 'item' (default).
Cell contents are calculated using
getOption('yamlet_cell_value', yamlet::cell_value)
to which
is passed the cell-specific metadata as well as sep
and def
.
## S3 method for class 'yamlet'
as.data.frame(
x,
row.names = "item",
optional = FALSE,
sep = "\n",
def = ": ",
...
)
x |
yamlet; see |
row.names |
a name for a column to hold top-level names, or NULL to represent these as row.names |
optional |
if TRUE and row.names is NULL, row.names will not be set |
sep |
separator for multiple items within an attribute |
def |
definition string: separator between items and their (preceding) names, if any |
... |
ignored |
data.frame
library(magrittr)
file <- system.file(package = 'yamlet', 'extdata','quinidine.yaml')
file %>% read_yamlet %>% explicit_guide %>% as.data.frame
file <- system.file(package = 'yamlet', 'extdata','phenobarb.csv')
# phenobarb.yaml has conditional metadata that benefits
# from interpretation in the context of the data itself.
# thus, we
# * read the whole 'decorated' object (not just yaml),
# * resolve the 'guide' ambiguity,
# extract the best-guess decorations, and
# convert to data.frame.
file %>% io_csv %>% resolve %>% decorations %>% as.data.frame
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.