-1

我一直在尝试安装 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’

发生了什么?提前致谢

放假

4

2 回答 2

1

使用or加载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)

这仍然会产生错误吗?

编辑

由于上面仍然给出错误,并且由于包具有正在逐步淘汰的属性(即,没有命名空间和 using .First.lib()),我建议联系包的维护者(也许参考 SO 上的这个问题):

packageDescription("sna")$Maintainer

同样,我怀疑问题在于在函数中创建对象ehelp.First.lib()因为没有指定包命名空间,所以调用该对象。

于 2012-04-11T12:10:19.020 回答
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 
于 2012-04-12T08:52:14.487 回答