我需要通过bash shell运行多个脚本,使用Rscript
和一些我使用的函数需要函数isGeneric
。然而,在这种情况下,进程会以这样的方式结束(例如):
Error in .getLogLik() : could not
find function "isGeneric"
Calls: main -> dredge -> .getLik -> .getLogLik
Execution halted
以下是复现方法:
# in the bash shell
echo "isGeneric('apply')" > /tmp/test.R
Rscript /tmp/test.R
结果:
Error: could not find function "isGeneric"
Execution halted
但是,如果我们打开一个R会话并输入以下内容,它可以正常工作:
# in the R shell
isGeneric('apply')
[1] FALSE
你知道这个问题来自哪里以及如何解决吗?
isGeneric
和methods
包之间的链接。 - Ludovic DuvauxError: could not find function "is"
。连接性甚至更不明显! - DavidCRscript --default-packages=methods,datasets,utils,grDevices,graphics,stats
,这样才能与R具有相同的默认包。如果只包含methods,则会缺少许多其他内容。 - Kem Mason