nls方法不能在ggplot的geom_smooth中工作

时间:2016-12-04 17:58:51

标签: r ggplot2 regression curve-fitting nls

我正在尝试使用代码来获取非线性回归,而不指定任何特定函数:

library(drc)
head(heartrate)
#  pressure   rate
#1    50.85 348.76
#2    54.92 344.45
#3    59.23 343.05
#4    61.91 332.92
#5    65.22 315.31
#6    67.79 313.50

library(ggplot2)
ggplot(heartrate, aes(pressure, rate)) + 
    geom_point() + 
    geom_smooth(method="nls", formula = rate ~ pressure)

但它给了我以下警告:

Warning message:
Computation failed in `stat_smooth()`:
object of type 'symbol' is not subsettable 

该图仅显示点。没有绘制回归线。

如何更正此问题?

0 个答案:

没有答案
相关问题