uses_mappings | R Documentation |
uses_mappings
checks whether the student used one or more mappings in
their plot. By default, uses_mappings
ignores whether or not the student
also supplied additional mappings. Use uses_extra_mappings
to check if they did.
If exact
is TRUE
, then all of the mappings have to match exactly.
uses_mappings(p, mappings, 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
|
local_only |
If |
exact |
If |
A logical value.
Other functions for checking mappings:
get_mappings()
,
identical_aes()
,
ith_mappings_use()
,
ith_mappings()
require(ggplot2)
p <- ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +
geom_point(mapping = aes(color = class))
uses_mappings(p, aes(x = displ))
uses_mappings(get_geom_layer(p, i = 1), aes(x = displ, color = class), local_only = FALSE)
uses_mappings(get_geom_layer(p, i = 1), aes(x = displ, color = class), local_only = TRUE)
uses_mappings(p, aes(x = displ, y = hwy), exact = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.