yaml_as_df | R Documentation |
Read yaml input into data frame
yaml_as_df(path, quiet = FALSE, row_var = ".row")
path |
to the yaml source file. |
quiet |
logical; if |
row_var |
character with length 1; column name where row names (from
the yaml source) will be stored. If |
A tibble is created from yaml content and returned. By default,
the first column in the data frame contains the outer names of the yaml
source (see row_var
argument and examples).
A prototyped table has one row identified as the prototype and
defines the table column names as well as the required number of
columns. This is similar behavior to what dplyr::tribble()
does.
Specify a prototype column name under SETUP__:
.
You must provide names for all columns in the prototype. Other rows
will inherit those names and you must enter a number of columns in
other rows equal to the number found in the prototype. If a prototype row
is used, then other rows do not need to be entered as (named) lists, but
can be entered as arrays; they will be coerced to list and named according
to the prototype.
path <- system.file("yaml", "table.yml", package = "pmtables")
yaml_as_df(path)
yaml_as_df(path, row_var = "name")
yaml_as_df(path, row_var = NULL)
# Example prototyped table
## Not run:
file <- system.file("yaml", "prototype.yaml", package = "pmtables")
cat(readLines(file), sep = "\n")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.