library(plot2)
# fails silently
with(
mtcars,
plot2(
x = mpg, by = cyl,
type = "density",
legend = list(x = "bottom!")
)
)
# fails outright
with(
mtcars,
plot2(
x = mpg, by = cyl,
type = "density",
legend = "bottom!"
)
)
#> Error in if (names(fargs[["legend"]])[1] == "") names(fargs[["legend"]])[1] = "x": argument is of length zero
Interestingly, this isn't a problem if we feed it a density object directly.
# this works, though
with(
mtcars,
plot2(
x = density(mpg), by = cyl,
legend = "bottom!"
)
)
Interestingly, this isn't a problem if we feed it a density object directly.