I am currently trying to create a scatterplot with a best-fit line.
df %>%
ggplot(aes(y = d_emp, x=d_gdp))
geom_point()
geom_smooth(method = "lm", se = "FALSE")
However, I keep getting the following error message:
Computation failed in
stat_smooth()
: invalid 'x' type in 'x || y'
The scatterplot works perfectly, it is only the best fit line that does not show (so the geom_smooth part).
Here is what my dataset looks like:
CodePudding user response:
You provided a string to the boolean argument se
. This should work
df %>%
ggplot(aes(y = d_emp, x = d_gdp))
geom_point()
geom_smooth(method = "lm", se = FALSE)