这个问题应该蛮傻的,但是我真的解决不了,希望不要吐槽我傻。
rstudio里面用pplot2
gasCars <- subset(vehicles, fuelType1 %in% c("Regular Gasoline", "Premium Gasoline", "Midgrade Gasoline") & fuelType2 == "" & atvType != "Hybrid")
mpgByYr_Gas <- ddply(gasCars, ~year, summarise, avgMPG = mean(comb08))
ggplot(mpgByYr_Gas, aes(year, avgMPG)) + geom_point() + geom_smooth() + xlab("Year") + ylab("Average MPG") + ggtitle("Gasoline cars")
然而,总是报错:Error in FUN(X[[i]], ...) : object 'avgMPG' not found
求大神指点。