I am trying to knit a chunk of code into an HTML file and a Word document, however, I keep receiving the following error: "Error: data
must be a data frame, or other object coercible by fortify()
, not an S3 object with class uneval Did you accidentally pass aes()
to the data
argument?"
Also there seems to be an issue with lines 38 through 42 of my code, but I am not sure what it is. My code is as follows:
library(ggplot2)
## Plot 1
p1 <- qplot(data = airquality,Temp,fill = Month,geom = "histogram", bins = 20)
p1
##Plot 2
p2 <- airquality %>%
+ ggplot(aes(x=Temp, fill=Month)) +
+ geom_histogram(position="identity", alpha=0.5, binwidth = 5, color = "white")+
+ scale_fill_discrete(name = "Month", labels = c("May", "June","July", "August", "September"))
p2
## Plot 3
p3 <- airquality %>%
+ ggplot(aes(Month, Temp, fill = Month)) +
+ ggtitle("Temperatures") +
+ xlab("Months") +
+ ylab("Frequency") +
+ geom_boxplot() +
+ scale_fill_discrete(name = "Month", labels = c("May", "June","July", "August", "September"))
p3
## Plot 4
p4 <- airquality %>%
+ ggplot(aes(Month, Temp, fill = Month)) +
+ ggtitle("Temperatures") +
+ xlab("Temperatures") +
+ ylab("Frequency") +
+ geom_boxplot()+
+ scale_fill_grey(name = "Month", labels = c("May", "June","July", "August", "September"))
p4
## Plot 5
p5 <- qplot(data = airquality,Ozone,fill = Month,geom = "histogram", bins = 20)
p5