has_field: Check if field exists in YAML

View source: R/yml_helpers.R

has_fieldR Documentation

Check if field exists in YAML

Description

has_field() retrieves the names of all fields (including nested fields) and checks if field is among them.

Usage

has_field(.yml, field)

Arguments

.yml

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

field

A character vector, the name of the field(s) to check for

Value

logical

See Also

Other yml: asis_yaml_output(), bib2yml(), draw_yml_tree(), read_json(), use_yml_defaults(), use_yml_file(), use_yml(), yml_author(), yml_blogdown_opts(), yml_bookdown_opts(), yml_citations(), yml_clean(), yml_distill_opts(), yml_latex_opts(), yml_output(), yml_pagedown_opts(), yml_params(), yml_pkgdown(), yml_reference(), yml_replace(), yml_resource_files(), yml_rsconnect_email(), yml_rticles_opts(), yml_runtime(), yml_site_opts(), yml_toc(), yml_vignette()

Examples


has_field(yml(), "author")
has_field(yml(), "toc")


ymlthis documentation built on Aug. 5, 2022, 5:23 p.m.