The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Type: Package
Title: Convert Dataframe to 'YAML'
Version: 0.3.1
Maintainer: Yabing Song <songyb0519@gmail.com>
Description: The 'df2yaml' aims to simplify the process of converting 'dataframe' to 'YAML' https://yaml.org/. The 'dataframe' with multiple key columns and one value column will be converted to the multi-level hierarchy.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.1.1
Imports: dplyr, rrapply, tibble, yaml, magrittr, rlang
Suggests: rmarkdown, prettydoc, knitr
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2023-01-20 13:02:54 UTC; songyabing
Author: Yabing Song [aut, cre]
Repository: CRAN
Date/Publication: 2023-01-26 12:50:02 UTC

Convert dataframe to YAML.

Description

Convert dataframe to YAML.

Usage

df2yaml(
  df,
  key_col,
  val_col,
  val_sep = ";",
  key_sep = ":",
  rm_quote = TRUE,
  out_yaml = NULL
)

Arguments

df

Dataframe.

key_col

The columns used as keys.

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 val_col. Default: ";".

key_sep

The separator used to seperate key and value. Default: ":".

rm_quote

Logical value, whether to remove single quotes. Default: TRUE.

out_yaml

Output YAML file. Default: NULL (return 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")

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 val_col. Default: ";".

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")

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.