Skip to contents

Convert two columns in a data frame to a 'YAML' sequece of keyed values

Usage

yamlify_cols_to_keyedvalues(x, keyCol = 1, valueCol = 2, returnYAML = TRUE)

Arguments

x

The data frame

keyCol

The column holding the keys (names)

valueCol

The column holding the values

returnYAML

Whether to return 'YAML' (TRUE) or a list (FALSE)

Value

'YAML' as character string or a list of lists

Examples

cat(
  rock::yamlify_cols_to_keyedvalues(
    mtcars[1:2, ]
  )
);
#> '21': 6.0
#> '21': 6.0