I am pretty new to R. I am trying to run a dataset with the following code:
ggplot(RW, aes(y=Caught, x=Stocked))+
geom_point()+
geom_smooth(method = lm)
I keep getting an error that says "geom_smooth() using formula 'y ~ x'"
Also, the graph isn't showing some points because the x and y values are out of the range. I want them to go from 0 to 140,000. Instead the y-axis goes from 118,708 to 73473.66 and the x-axis goes from 140,522 to 59613 I have tried a couple different ways but keep getting another error, which is "Error: Discrete value supplied to continuous scale"
is not an error. Since you did not supply a formula for the fit, geom_smooth assumed y ~ x, which is just a linear relationship between x and y. You can avoid this warning by using
geom_smooth(formula = y ~ x, method = "lm")
The axis behavior you describe and the error about discrete values suggests that non-numeric values, i.e. text, are being passed to a function. Can you post the code you use to set the axis limits? It would also be useful to see the output of
summary(RW)
Place lines containing only three back ticks, ```, just before and just after the output.
```
paste the output here
```