is_ggplot | R Documentation |
is_ggplot()
tests if an object is a ggplot.
stop_if_not_ggplot()
signals an error if an object is not
a ggplot.
fail_if_not_ggplot()
returns a failing grade if an
object is not a ggplot.
is_ggplot(p)
stop_if_not_ggplot(p, message = getOption("ggcheck.error"))
fail_if_not_ggplot(
p = .result,
message = getOption("ggcheck.fail"),
env = parent.frame()
)
p |
An object |
message |
A message to be displayed if |
env |
Environment in which to find |
is_ggplot()
returns TRUE
if p
is a ggplot
object; otherwise it returns FALSE
.
stop_if_not_ggplot()
returns an error if p
is not a
ggplot object; other it invisibly returns NULL
.
fail_if_not_ggplot()
returns a failing grade if p
is
not a ggplot object; other it invisibly returns NULL
.
require(ggplot2)
p_valid <- ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +
geom_point()
is_ggplot(p_valid)
stop_if_not_ggplot(p_valid)
fail_if_not_ggplot(p_valid)
p_invalid <- geom_point()
is_ggplot(p_invalid)
## Not run:
stop_if_not_ggplot(p_invalid)
## End(Not run)
fail_if_not_ggplot(p_valid)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.