yml_replace() replaces a named field with another value. As opposed to duplicating top-level fields with other functions, explicitly replacing them with yml_replace() will not raise a warning. yml_discard() removes values given either a character vector of names or a purrr-style lambda with a predicate (~ predicate); see the examples. yml_pluck() and yml_chuck() are wrappers around purrr::pluck() and purrr::chuck() that return yml objects.

yml_replace(.yml, ...)

yml_discard(.yml, .rid)

yml_pluck(.yml, ...)

yml_chuck(.yml, ...)



a yml object created by yml(), as_yml(), or returned by a yml_*() function


additional named R objects, such as characters or lists, to transform into YAML


a character vector of fields to remove or a purrr-style lambda with a predicate (~ predicate) where fields that are TRUE will be discarded


a yml object

See also


# \donttest{ yml() %>% yml_clean(TRUE) %>% yml_replace(clean = FALSE) %>% yml_discard("author")
#> --- #> date: '`r format(Sys.Date())`' #> clean: false #> --- #>
yml() %>% yml_output( pdf_document(), html_document() )%>% yml_discard(~ length(.x) > 1)
#> --- #> author: Malcolm Barrett #> date: '`r format(Sys.Date())`' #> --- #>
# }