我一直在尝试安装SNA软件包,但我总是会遇到下一个错误,
> install.packages("sna")
Installing package(s) into ‘/home/rvaca/R/i486-pc-linux-gnu-library/2.14’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Loading Tcl/Tk interface ... done
trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/sna_2.2-0.tar.gz'
Content type 'application/x-gzip' length 273329 bytes (266 Kb)
opened URL
==================================================
downloaded 266 Kb
The downloaded packages are in
‘/tmp/Rtmp7iF3Qz/downloaded_packages’
> library(sna)
starting httpd help server ... done
Error in attr(helpObj, "call") <- this.call :
attempt to set an attribute on NULL
Error: package/namespace load failed for ‘sna’
> library("sna")
Error in attr(helpObj, "call") <- this.call :
attempt to set an attribute on NULL
Error: package/namespace load failed for ‘sna’
> library('sna')
Error in attr(helpObj, "call") <- this.call :
attempt to set an attribute on NULL
Error: package/namespace load failed for ‘sna’
发生什么事了?提前致谢
vacing
答案 0 :(得分:1)
使用sna
或library(sna)
加载require(sna)
包时,(仍然)调用函数.First.lib()
。此函数现在是基础包中已解散的函数之一(请参阅?.First.lib
),但这不是重点。
查看sna的源文件,.First.lib()
在文件zzz.R中定义并包含行
ehelp <- help(package="sna")$info[[1]].
如果getOption("help_type")
不是"text"
,则效果不佳。因此,您可以在加载包之前尝试设置此选项,看看是否有效。
options(help_type="text")
library(sna)
这是否仍会产生错误?
修改强>
由于上面仍然给出了错误,并且由于包具有被淘汰的属性(即,没有命名空间,并且使用.First.lib()
),我建议联系包的维护者(可能参考关于SO的这个问题:
packageDescription("sna")$Maintainer
同样,我怀疑问题在于在ehelp
函数中创建对象.First.lib()
,因为没有指定包名称空间,所以会调用该对象。
答案 1 :(得分:0)
好的,这是sessionInfo()的结果,(我忘了评论我将它运行到Eclipse中)
> sessionInfo()
R version 2.14.2 (2012-02-29)
Platform: i486-pc-linux-gnu (32-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8
[9] LC_ADDRESS=en_US.UTF-8 LC_TELEPHONE=en_US.UTF-8
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] Cairo_1.5-1 igraph_0.5.5-4 rj_1.0.3-7
loaded via a namespace (and not attached):
[1] rj.gd_1.0.3-3 sna_2.2-0 tools_2.14.2