I'm trying to make a simple boxplot with ggplot2. I've got a vector with numbers but when I type in the code an this error message appears:
Error: ggplot2 doesn't know how to deal with data of class numeric.
What does that mean?
Code:
vector1 <- c(x1, x2, x3, ...)
library(ggplot2)
ggplot(vector1, aes(x=x, y=value)) + boxplot()
You can use
qplot
as follows:Or (as @scoa pointed out) concert vector1 to a
data.frame
asggplot
operates only ondata.frame
s and not on vectors.qplot
is a convenience wrapper for very simple plots.