df2yaml2 {df2yaml} | R Documentation |
Convert dataframe to YAML.
Description
Convert dataframe to YAML.
Usage
df2yaml2(
df,
key_col = c("paras", "subcmd"),
val_col = "values",
val_sep = ";",
key_sep = ":",
out_yaml = NULL
)
Arguments
df |
Dataframe. |
key_col |
The columns used as keys, up to 2. |
val_col |
The columns used as values, this column can contain key: value pairs. |
val_sep |
The separator used to seperate different key:value pairs in |
key_sep |
The separator used to seperate key and value. Default: ":". |
out_yaml |
The output yaml file. Default: NULL (string). |
Value
NULL (write YAML) or string (if out_yaml
is NULL).
Examples
library(df2yaml)
test_file <- system.file("extdata", "df2yaml_l3.txt", package = "df2yaml")
test_data <- read.table(file = test_file, header = TRUE, sep = "\t")
df2yaml(df = test_data, key_col = c("paras", "subcmd"), val_col = "values")
[Package df2yaml version 0.3.1 Index]