The documentation for qplot doesn't contain the 'method' parameter. The error I get is -
> qplot(displ, hwy, data = mpg, geom=c("point", "smooth"),facets=.~drv,method="loess")
Error: Unknown parameters: method
My version of R is 3.2.1 and ggplot2 version is 2.0.0, if it helps.
Welcome to SO.
You're getting the error because of the update in ggplot2
; the tutorial that you're looking at was probably from an older version. You will see that at a lot of places on the internet.
For reference: On this forum, one generally posts the objective of the exercise, the exact (or minimum working example) code and output and states the efforts made at the stage where stuck. This helps the other members give a more coherent answer.
No need for method
as geom_smooth()
assumes loess
qplot(displ, hwy, data = mpg, geom=c("point", "smooth"),facets=.~drv)
If geom="smooth", a loess fit line and confidence limits are added by default. When the number of observations is greater than 1,000, a more efficient smoothing algorithm is employed. Methods include "lm" for regression, "gam" for generalized additive models, and "rlm" for robust regression. The formula parameter gives the form of the fit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With