I’m creating a custom yaml using the yaml
function. Since the yaml can become large I would like to insert some line breaks between values. Unfortunately, I’m not sure how to do that. Here is some reproducible code:
library(yaml)
your_yaml <- list(test = list(TRUE,
FALSE),
test2 = list(A = TRUE))
yaml_text <- as.yaml(your_yaml)
cat(as.character(yaml_text), sep = "n", append = TRUE)
#> test:
#> - yes
#> - no
#> test2:
#> A: yes
This creates a really simple yaml, but now I would like to insert a line break between - no
and test2
values. If we use a “n” this doesn’t work:
library(yaml)
your_yaml <- list(test = list(TRUE,
FALSE),
"n",
test2 = list(A = TRUE))
yaml_text <- as.yaml(your_yaml)
cat(as.character(yaml_text), sep = "n", append = TRUE)
#> test:
#> - yes
#> - no
#> '': |2+
#>
#> test2:
#> A: yes
Created on 2024-06-07 with reprex v2.1.0
My expected outcome should look like this:
#> test:
#> - yes
#> - no
#>
#> test2:
#> A: yes
So I was wondering if anyone knows how to enter a line break like this in a custom yaml?
Recognized by R Language Collective