ith_geom_is: Is the ith geom what it should be?

View source: R/geoms.R

ith_geom_isR Documentation

Is the ith geom what it should be?

Description

ith_geom_is checks whether the ith layer uses the prescribed type of geom.

Usage

ith_geom_is(p, geom, i = 1)

Arguments

p

A ggplot object

geom

A character string that corresponds to the suffix of a ggplot2 geom_ function, e.g. "point".

i

A numerical index that corresponds to the first layer of a plot (1), the second layer (2), and so on. ith_geom_is will check the geom used by the ith layer.

Value

TRUE or FALSE

See Also

Other functions for checking geoms: get_geoms_stats(), get_geoms(), ith_geom_stat(), ith_geom(), uses_geoms()

Examples

require(ggplot2)
p <- ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +
  geom_point(mapping = aes(color = class)) +
  geom_smooth()
ith_geom_is(p, geom = "smooth", i = 2)

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