Captures the data and the settings for one figure as a value, validates
them, and returns an object that gfplot_render() turns into a ggplot.
Use this when the figure is decided in one place and drawn in another, or
when a specification needs to be stored, compared, or passed across a
process boundary.
Arguments
- family
Figure family, for example
"forest".- ...
Family-specific arguments. For
"forest":data,term,estimate,lower, andupper, plus the optional settings documented inplot_forest().
Details
Call gfplot_families() for the available families and their required
arguments.
Examples
effects <- data.frame(
term = c("Age", "Stage III"),
hr = c(1.02, 1.84),
lower = c(0.99, 1.51),
upper = c(1.05, 2.24)
)
spec <- gfplot_spec(
"forest",
data = effects, term = "term",
estimate = "hr", lower = "lower", upper = "upper"
)
spec
#> <gfplot_spec>
#> • family: "forest" (Forest plot)
#> • arguments: "data", "term", "estimate", "lower", and "upper"