use_file_yml: Write YAML to file

use_yml_fileR Documentation

Write YAML to file

Description

Write yml objects to a file. use_yml_file() writes to any given file name. use_output_yml() creates file _output.yml, which can be used by multiple R Markdown documents. All documents located in the same directory as _output.yml will inherit its output options. Options defined within document YAML headers will override those specified in _output.yml. Note that use_output_yml() plucks the output field from yml; any other YAML top-level fields will be ignored. use_site_yml creates _site.yml for use with R Markdown websites and third-party tools like the distill package (see the R Markdown book for more). use_navbar_yml is a special type of site YAML that only specifies the navbar in _navbar.yml use_pkgdown_yml() and use_bookdown_yml() write YAML files specific to those packages; see the pkgdown and blogdown documentation for more.

Usage

use_yml_file(
  .yml = NULL,
  path,
  build_ignore = FALSE,
  git_ignore = FALSE,
  quiet = FALSE
)

use_output_yml(
  .yml = NULL,
  path = ".",
  build_ignore = FALSE,
  git_ignore = FALSE,
  quiet = FALSE
)

use_site_yml(
  .yml = NULL,
  path = ".",
  build_ignore = FALSE,
  git_ignore = FALSE,
  quiet = FALSE
)

use_navbar_yml(
  .yml = NULL,
  path = ".",
  build_ignore = FALSE,
  git_ignore = FALSE,
  quiet = FALSE
)

use_pkgdown_yml(
  .yml = NULL,
  path = ".",
  build_ignore = TRUE,
  git_ignore = FALSE,
  quiet = FALSE
)

use_bookdown_yml(
  .yml = NULL,
  path = ".",
  build_ignore = FALSE,
  git_ignore = FALSE,
  quiet = FALSE
)

Arguments

.yml

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

path

a file path to write the file to

build_ignore

Logical. Should the file be added to the .Rbuildignore file?

git_ignore

Logical. Should the file be added to the .gitignore file?

quiet

Logical. Whether to message about what is happening.

Details

By default, the yaml package adds a new line to the end of files. Some environments, such as RStudio Projects, allow you to append new lines automatically. Thus, you may end up with 2 new lines at the end of your file. If you'd like to automatically remove the last new line in the file, set options(ymlthis.remove_blank_line = TRUE).

See Also

yml_bookdown_opts yml_bookdown_site yml_pkgdown yml_pkgdown_articles yml_pkgdown_docsearch yml_pkgdown_figures yml_pkgdown_news yml_pkgdown_reference

Other yml: asis_yaml_output(), bib2yml(), draw_yml_tree(), has_field(), read_json(), use_yml_defaults(), 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()


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