food <- c(5, 8, 15, 20, 4, 18)
barplot(food)
meanValue <- mean(food)
abline(h=meanValue)
Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) :
plot.new has not been called yet
我是R初学者。我该如何解决这个问题?我从其他答案中看到,我必须首先绘制它。但是我的情节是什么? plot(food)
或plot(meanValue)
?