geom_smooth 用于线性模型

问题描述

使用此代码,它创建了 3 条线性回归线(每个“教育级别”一条)。我怎样才能让它在表格中的所有数据中产生一条单一的回归线? 非常感谢!

edu_level <- case_when(swiss$Education <= 10 ~ "Low",swiss$Education > 10 & swiss$Education <= 28 ~ "Medium",swiss$Education > 28 ~ "High")
swiss %>% mutate(Canton= rownames(.)) %>% ggplot() 
+ aes(x=Examination,y=Agriculture,color=edu_level) 
+ geom_point() + scale_color_discrete("Education level") 
+ geom_smooth(method = "lm") 
+ theme(legend.title = element_text(size = 10),legend.text = element_text(size = 10))

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)