R: Consult an option, then default

opt {reprex} | R Documentation

## Consult an option, then default

### Description

Arguments that appear like so in the usage:

    f(..., arg = opt(DEFAULT), ...)

get their value according to this logic:

    user-specified value or, if not given,
      getOption("reprex.arg") or if does not exist,
        DEFAULT

It's shorthand for:

    f(..., arg = getOption("reprex.arg", DEFAULT), ...)

This is not an exported function and should not be called directly.

### Details

Many of the arguments of `reprex()` use `opt()`. If you don't like the official defaults, override them in your `.Rprofile`. Here's an example for someone who dislikes the "Created by ..." string, always wants session info, prefers to restyle their code, uses a winky face comment string, and likes the tidyverse startup message.

    options(
      reprex.advertise = FALSE,
      reprex.si = TRUE,
      reprex.style = TRUE,
      reprex.comment = "#;-)",
      reprex.tidyverse_quiet = FALSE
    )

[Package reprex version 0.2.0 Index]