Reputation: 1
After creating a plot of plant height vs shoot diameter, I want to add a line resulting from a linear regression. However, I keep getting a strange error with abline().
plot(log(conyza$diameter_cm), log(conyza$height_cm),
main = "Shoot diameter and Plant height", xlab = "Shoot diameter", ylab = "Plant height")
Regression1 <- lm(conyza$LOGheight ~ conyza$LOGdiameter)
abline(coef = Regression1$coefficients)
I then get the error: Error in abline(coef = Regression1wo$coefficients) : ... must contain names or character strings
One suggestion was that the error is because Regression1$coefficients is a table, but if I try the following code, I get the exact same error.
abline(4, 0.5)
The same goes for:
abline(a = 4, b = 0.5)
I had this issue once before and was able to fix it by just restarting R. This time, however, restarting R doesn't fix the problem. Does anyone have another suggestion for what's happening and how I can avoid this error?
Upvotes: 0
Views: 76