Learn R Programming

metaplot (version 0.7.1)

metOption: Get Option with Partial Matching

Description

Gets an option value. Selects the longest among all leading partial matches. (Ties are broken by sorting and taking the first.) This allows multiple options to be set simultaneously, and allows a subset of these to be overridden. The intended effect is similar to cascading style sheets.

Usage

metOption(x, default = NULL)

Arguments

x

a character string holding an option name

default

the value returned if option is not set

See Also

getOption

Examples

Run this code
# NOT RUN {
library(magrittr)
library(dplyr)
library(csv)
x <- as.csv(system.file(package = 'metaplot', 'extdata/theoph.csv'))
x %<>% pack

multiplot(
x %>% metaplot(conc, gg = F),
x %>% metaplot(conc, time, gg = F),
x %>% metaplot(conc, arm, gg = F),
x %>% metaplot(conc, arm,  gg = T)
)

# Add a reference line at 9 mg/L
x$conc %<>% structure(reference = 9)

# Make the reference line green universally.
options(metaplot_ref_col = 'green')

# Make the reference line orange for density plots
options(metaplot_ref_col_dens = 'orange')

multiplot(
x %>% metaplot(conc, gg = F),
x %>% metaplot(conc, time, gg = F),
x %>% metaplot(conc, arm, gg = F),
x %>% metaplot(conc, arm,  gg = T)
)

# Restore defaults
options(metaplot_ref_col = NULL)
options(metaplot_ref_col_dens = NULL)
# }

Run the code above in your browser using DataLab