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
I would first confirm the lm() is working with your data. I see that the demo and tot columns are of type character. To make them numeric, you need to remove the . characters. Try
I do not know of a way to include the thousands separator in a data frame and maintain the numeric type. Since thousands separators are locale dependent, it would seem risky to include them in the data frame numeric columns.
Can you explain what you are trying to achieve by having the thousands separator in those columns?