Help with abline, line not showing

Hi! I have this code
igiena<-read.csv("Populatia cu acces la igiena de baza.csv")
igiena$Entity<-as.factor (igiena$Entity)
igiena$Entity<-as.numeric (igiena$Entity)
str (igiena)
cor_matrix<-cor (igiena)
cor(igiena, use ="complete.obs")
pairs (igiena)
cor_matrix <- cor(igiena, use="pairwise.complete.obs")
plot(igiena$hyg_lim ~ igiena$hyg_bas)
abline(lm(hyg_lim ~ hyg_bas, data = igiena), col = "green")
abline(h =mean(igiena$hyg_bas), col = "red")

I can see the green line but the red line doesnt show. What is the problem?

try changing to

abline(h =mean(igiena$hyg_bas, na.rm = TRUE), col = "red")
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.