【发布时间】:2020-09-16 07:17:46
【问题描述】:
我正在尝试使用 plotly 将整个数据帧的黄土线(或线性模型)拟合到数据帧的子集上。
model_LV2F<- loess(p_LV2F ~schoolweging, data = df)
plot_ly(df_subset) %>%
add_markers(x=~schoolweging, y=~p_LV2F, marker=list(color="red", opacity=3/10), name="2F") %>%
add_lines(x=~schoolweging, y=~model_LV2F$fitted, line=list(color="red"))
我收到错误“Tibble 列必须具有兼容的大小。”,因为该模型基于 6000 个观察值,而子集数据框仅包含 23 个观察值。
如何从另一个数据框中添加预先计算的参考线?
【问题讨论】: