get_stats: List the stats used by a plot

View source: R/stats.R

get_statsR Documentation

List the stats used by a plot

Description

get_stats returns a vector of stats names, written as character strings, that describes which stats in which order are used by a plot.

Usage

get_stats(p)

Arguments

p

A ggplot object

Value

A vector of character strings. Each element corresponds to the suffix of a ggplot2 stat_ function, e.g. c("identity", "smooth").

See Also

Other functions for checking stats: ith_stat_is(), ith_stat(), uses_stats()

Examples

require(ggplot2)
p <- ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +
  geom_point(mapping = aes(color = class)) +
  geom_smooth()
get_stats(p)

rstudio-education/ggcheck documentation built on May 12, 2023, 11:33 a.m.