我正在尝试使用图表包(v 1.6)在 R 中重新制作流程图。我能够使用这个确切的脚本(我从图表文档中的示例修改)制作图表,但是一旦我将 R 更新到 3.0.0,坐标函数就会给我一个错误。这是一个例子:
library(graphics)
library(diagram)
par(mar = c(1, 1, 1, 1))
openplotmat()
elpos<-coordinates(c(1,1,2,4))
Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘coordinates’ for signature ‘"numeric"’
我对 R 和代码等还是很陌生,所以当我运行 traceback() 时,我真的不明白它在告诉我什么:
3: stop(gettextf("unable to find an inherited method for function %s for signature %s",
sQuote(fdef@generic), sQuote(cnames)), domain = NA)
2: (function (classes, fdef, mtable)
{
methods <- .findInheritedMethods(classes, fdef, mtable)
if (length(methods) == 1L)
return(methods[[1L]])
else if (length(methods) == 0L) {
cnames <- paste0("\"", sapply(classes, as.character),
"\"", collapse = ", ")
stop(gettextf("unable to find an inherited method for function %s for signature %s",
sQuote(fdef@generic), sQuote(cnames)), domain = NA)
}
else stop("Internal error in finding inherited methods; didn't return a unique method",
domain = NA)
})(list("numeric"), function (obj, ...)
standardGeneric("coordinates"), <environment>)
1: coordinates(c(1, 1, 2, 4))
大多数情况下,我不知道为什么坐标()在更新后不起作用。任何对此的见解,以及可能的回溯翻译都将是一个巨大的帮助。谢谢!