【问题标题】:"Replacement has n rows, data has p" error message with loess()“替换有 n 行,数据有 p”带有 loess() 的错误消息
【发布时间】:2016-03-31 11:18:29
【问题描述】:

这个问题与to this one有关。

我正在尝试在ggplot2stat_smooth() 中使用loess(),这样:

ggplot(data = mydf, aes(x=time, y=pdm, z=surface))
    + geom_point() + stat_smooth(col="red") 
    + stat_quantile(formula = loess(mydf$pdm ~ mydf$time), quantiles = c(0.25, 0.5, 0.75))

但是,我收到以下错误消息:

警告信息:

1:“newdata”有 100 行,但找到的变量有 6816 行

2: 'stat_quantile()' 中的计算失败:

替换有6816行,数据有100

知道发生了什么/如何让它工作吗?

谢谢

【问题讨论】:

    标签: r loess


    【解决方案1】:

    stat_quantile 不支持这个。 formula 应该是一个公式对象,然后传递给方法。如果您需要加性分位数回归平滑,请使用method = "rqss"。如果你想使用stat_smooth,实际使用stat_smooth。但是,formula 仍然需要一个公式对象,但您可以在那里使用loess 作为方法。

    【讨论】:

      猜你喜欢
      • 2017-09-19
      • 2018-02-19
      • 1970-01-01
      • 2015-07-01
      • 2018-05-15
      • 2018-02-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多