Skip to contents

publishing context

The context in which a figure is created often impacts its aesthetics, and each publishing context may require separate options or configuration settings to obtain a uniform output. metayer::sure_plot provides a DRY solution.

The authoring vignette describes patterns to uniformize output at each stage of the publishing pipeline.

sure_plot({
    plot(pcd$x, pcd$y)
  },
  height = 5,
  width = 5,
  par_opts = list(bg = "#f1d08f")
)

cli / logger integration

As code shifts from prototype to production, logging becomes important. Given the ubiquity of the cli and logger packages, it would be nice if messages that were originally headed for an interactive terminal could be seamlessly integrated into the logs.

The logger integration vignette shows the details of how metayer makes this work.

# contextualized cli calls
cli_alert("do what you love!") %>% 
  suppressMessages()
[INFO/global] > do what you love! 

global hierarchical storage

metayer implements a global hierarchical storage container which is simple to use. The hierarchical storage vignette does a deeper dive.

# pluck-like: create a persistent, hierarchically indexed environment
rm.all()
order_env <- local({
  order_id <- "D1234"
  storage_env("metayer", "menu", "dinner", order_id)
})
identical(.storage$metayer$menu$dinner[["D1234"]], order_env)
[1] TRUE

metaprogramming helpers

metayer provides two methods for easing metaprogramming tasks, wrapped_factory and with_monkey_patch. Specifics are available in the metaprogramming vignette.

configurability

metayer is designed to be incorporated into future projects. As such, it aims to be configurable. Details are in the configuration vignette.

miscellanea

Some other useful metayer utilities can be found in the miscellanea vignette.