How can I modify the method= argument in ggplot so to customize my loess function?
Right now this is my code without implementing a function:
ggplot(data, aes(x = X, y = Y)) +
geom_point() +
geom_smooth(method = "loess", fill='darkred', level=0.90)
And this is the function I would like to implement under the method= argument:
loess(Y ~ X, data=data, span=0.08, degree =1, family = 'gaussian')
You can pass arguments to
loess()via themethod.argsargument ofgeom_smooth():Edit following comments: