Skip to contents

When metayer is loaded, it populates several options and sets up logging. Much of this can be configured by making changes to config.yml.

configurability

Package configuration is specified in config.yml, which is designed to mimic the behavior of the config package. As such, the top-level sections–default, testing, and jupyter–are intended to correspond to an execution / operational mode. Our extension, config_get, enables YAML references and provides a few default handlers for custom YAML tags.

A link to the current YAML config.

custom YAML tags

Note that there are custom YAML tags available, !optenv and !with_env.

!optenv

optenv is used to evaluate simple R expressions, like logger::INFO; the idea is to simplify the specification of objects or functions.

!with_env

with_env allows strings to contain environment variables.

config.yml

logger

format

A string specification for the logging format passed to logger::log_format

logfile

The location of a log file. This will become the log_appender at namespace global and index one.

appenders

A list of appenders that will populate subsequent indexes of the global namespace.

threshold

The log threshold, e.g., logger::INFO

options

cli.default_handler

We set this to cli_nullity_handler in order to enjoy null visibility in cli output.

cli.ansi

Useful in testing to ensure that output doesn’t have escape codes.

cli.unicode

Useful in testing to ensure that output doesn’t have unusual unicode characters.

cli.num_colors

Useful in testing to ensure that output doesn’t have escape codes.

cli.condition_unicode_bullets

Useful in testing to ensure that output doesn’t have unusual unicode characters.

knitr.chunk.error

An aesthetic choice for R output.

A cosmetic change for imbuing R output with class tags suitable for CSS.

mty.cli_null

The substitution made for NULL values in cli output.

mty.fig.*

with_grdev default parameters. See the function reference.

uuid.generator

When testing, set this to test_mty_uuid for reproducible uuid-like output.

uuid.generator.seed

A seed value for the uuid.generator.

display

ippx, ippy

Inches per pixel. Not currently used. This would be helpful for creating interactive devices–e.g. X11–with dimensions specified in pixels rather than inches.

knitr

shim

The shim will be included in Rmd files after the YAML header and before the main text. It allows us to clearly set knitr options in the most local context. This is in contrast to setting environmental variables which can tricky to manage when documents are generated in isolated subprocesses.

N.B., in the example below, triple tilde should be triple backtick, but there were rendering issues.

shim: |
~~~{r setup, include = FALSE}
  library(magrittr)
  library(rlang)
  library(metayer)
~~~

~~~{r, include = FALSE}
  Sys.setenv(R_CONFIG_ACTIVE = "jupyter")

  # knitr options [ref](https://yihui.org/knitr/options/) documentation; 
  knitr::opts_chunk$set(
    metayer_hook = TRUE,
    comment = "",
    fig.path = "assets/knitr/",
    
    # c.f., _pkgdown \ templates \ includes
    class.output = c("sourceCode", "rOutput")
  )

  knitr::opts_knit$set(
    root.dir = here::here("vignettes")
  )

  knitr::knit_hooks$set(
    metayer_hook = knitr_metayer_hook
  )
~~~

rdoc_config

This section serves as the default YAML header for new jupyter notebooks. With this, one really only needs to specify a title when creating new documents.

output

The usual jupyter YAML content.

html_vignette:
  toc: yes
  toc_depth: 2
html_document:
  theme: flatly
  highlight: tango
  pandoc_args: '!with_env --resource-path={R_HERE_HERE}/vignettes'
pdf_document:
  pandoc_args: '!with_env --resource-path={R_HERE_HERE}/vignettes'

rmall_exclusions

A list of functions to blacklist when running rm.all.