因此,我使用链接上给出的步骤安装了 SparkR:“ https://amplab-extras.github.io/SparkR-pkg/ ”。我已经使用网站上给出的直接命令从 Github 存储库安装了它。现在,这是我的代码:
library(SparkR)
sc <- sparkR.init(master="local")
files <- paste0("NP",1:10,".txt")
func.clique <- function(file)
{
w <- read.table(file)
g <- graph.edgelist(cbind(as.character(w$V1),as.character(w$V2)))
plot(g)
cli <- cliques(g)
return (cli)
}
includePackage(sc, igraph)
cliquevalues <- sapply(files,func.clique)
igraph
现在,当我直接使用该库时,这段代码工作得非常好(在 RStudio 中没有 SparkR 命令) 。但是现在,当我执行它时,它说,Error in FUN(X[[i]], ...) : could not find function "graph.edgelist"
. 这可能是什么原因?我试过把它includePackage
放在几个地方,但似乎没有帮助。请帮忙!谢谢。