| ith_mappings_use | R Documentation |
ith_mappings_use checks whether the student uses the supplied mappings
in the ith layer of their plot.
ith_mappings_use(p, mappings, i, local_only = FALSE, exact = FALSE)
p |
A ggplot object or a layer extracted from a ggplot object with
|
mappings |
One or more aesthetic mappings created with
|
i |
A numerical index that corresponds to the first layer of a plot (1),
the second layer (2), and so on. |
local_only |
If |
exact |
If |
ith_mappings_use ignores whether or not the student supplied
additional mappings as well. Functions that use the ith_ prefix are
designed to eliminate the need to call get_layer to check a specific
layer in a plot, e.g. p
uses_mappings(aes(color = class)).
A logical value
Other functions for checking mappings:
get_mappings(),
identical_aes(),
ith_mappings(),
uses_mappings()
require(ggplot2)
p <- ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +
geom_point(mapping = aes(color = class)) +
geom_smooth()
ith_mappings_use(p, i = 1, aes(x = displ), local_only = FALSE)
ith_mappings_use(p, i = 1, aes(x = displ), local_only = TRUE)
ith_mappings_use(p, i = 2, aes(x = displ, y = hwy), local_only = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.