This should work, but currently doesn't, since add_trace() only knows about the data that is input to plot_ly()
library(plotly)
library(broom)
library(dplyr)
economics %>%
mutate(rate = unemploy / pop) %>%
plot_ly(x = date, y = rate) %>%
loess(rate ~ as.numeric(date), data = .) %>%
augment() %>%
add_trace(y = .fitted)
#> Error in eval(expr, envir, enclos) : object '.fitted' not found
This should work, but currently doesn't, since
add_trace()only knows about the data that is input toplot_ly()