lm1<-lm(formula = height~age,data=newdata)
summary(lm1)
library(ggplot2)
plot1<-ggplot(data=newdata, aes_string(x = age, y = height) + geom_point(size = 2) + theme_classic() + geom_smooth(method = "lm") + theme(legend.position = "none"))
#底下是报错内容,尝试更改aes符号,仍然无效
plot1<-ggplot(data=newdata, aes_(x = age, y = height) + geom_point(size = 2) + theme_classic() + geom_smooth(method = "lm") + theme(legend.position = "none"))
Error in aes_(x = age, y = height) : object 'age' not found
View(newdata)
View(newdata)
plot1<-ggplot(data=newdata, aes_string(x = age, y = height) + geom_point(size = 2) + theme_classic() + geom_smooth(method = "lm") + theme(legend.position = "none"))
Error in aes_string(x = age, y = height) : object 'age' not found
实际上,age和height都是newdata中的变量,不知道为什么not found, 求解答,谢谢
https://blog.csdn.net/weixin_30539625/article/details/98029667