Hi, I want to add a regression line to my existing scatter plot.
i have following dataframe named "alle":
> str(alle)
'data.frame': 11 obs. of 4 variables:
$ demo : chr "498.300.775" "500.297.033" "502.090.235" "503.170.618" ...
$ tot : chr "4.846.423" "4.891.934" "4.901.358" "4.906.313" ...
$ besch: num 69.8 70.3 69 68.6 68.6 68.4 68.4 69.2 70.1 71.1 ...
$ usd : num 1.37 1.47 1.39 1.33 1.39 ...
wtih following code i tried to draw the regression line but i get errors:
> abline(lm(alle$demo~alle$tot)$coef)
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
NA/NaN/Inf in 'y'
In addition: Warning message:
In storage.mode(v) <- "double" : NAs introduced by coercion
i know that i have no NAs(my dataframe is very small) but i checked it with isAny function too:
> any(is.na(alle))
[1] FALSE
so how can i fix this problem? i want to draw just one regression line to my existing scatter plot 