I am trying to apply loess smoothing to a scatterplot (i.e. between two quantitative variables). I would like to plot where the loess smoothing occurs in the scatterplot, and then would like to extract only the data points in the scatterplot that are above that smoothing.
For instance, if this is my scatterplot:
qplot(mpg, cyl, data=mtcars)
And I wanted to superimpose the smoother:
qplot(mpg, wt, data=mtcars) + with(mtcars, loess.smooth(mpg, wt))
This results in the error: "Don't know how to add o to a plot".
Then, assuming I could get that superimposition to work, I would like to extract only the cars that are above that line.