abline()函数在R 3.0.1中不起作用

时间:2013-09-17 08:44:38

标签: r plot

当我尝试将abline()拟合线甚至基本线添加到现有情节时,lm()会出现奇怪的行为。

x = seq(1:5)

y = seq(2,10,2)

plot(y~x)

abline(lm(y~x))

得到我:

Error in xy.coords(x, y) : argument "y" is missing, with no default

类似地:

abline(h = 2)

给予

Error in points(x, y, pch = pch, col = col, bg = bg, cex = cex) : 
argument "x" is missing, with no default

如果我提取abline代码,我会看到:

function (x, y, col = par("col"), bg = NA, pch = par("pch"), cex = 1, col.smooth = "red", span = 2/3, iter = 3, ...)

{
    points(x, y, pch = pch, col = col, bg = bg, cex = cex)
    ok <- is.finite(x) & is.finite(y)
    if (any(ok)) 
        lines(stats::lowess(x[ok], y[ok], f = span, iter = iter), 
            col = col.smooth, ...)
}

helpfile的函数语法为abline(a = NULL, b = NULL, h = NULL, v = NULL, reg = NULL, coef = NULL, untf = FALSE, ...)

我是否有可能通过安装另一个覆盖了abline()功能的软件包来破坏R图形软件包的某些部分?如果是这样,我该如何检查和修复?

干杯,

戴夫

0 个答案:

没有答案