gpt4 book ai didi

r - 加载 .Rprofile 时在 R 上安装包失败

转载 作者:行者123 更新时间:2023-12-01 05:18:28 25 4
gpt4 key购买 nike

当我尝试在 R 中安装软件包时,如果我的 .Rprofile 安装几乎总是失败已加载。当我用 --vanilla 加载 R 时但是,我可以毫无问题地安装软件包。这是有问题的 R session 的输出。我认为难度与我的.First()有关。 .Rprofile 中的函数或到历史文件。 My Rprofile file is here .

$ install.packages("SuppDists")
Installing package into ‘/home/lmullen/R/x86_64-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/SuppDists_1.1-9.tar.gz'
Content type 'application/x-gzip' length 140784 bytes (137 Kb)
opened URL
==================================================
downloaded 137 Kb

Loading required package: stats
Loading required package: sp
rgeos version: 0.2-19, (SVN revision 394)
GEOS runtime version: 3.3.3-CAPI-1.7.4
Polygon checking: TRUE

rgdal: version: 0.8-10, (SVN revision 478)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.9.0, released 2011/12/29
Path to GDAL shared files: /usr/share/gdal/1.9
Loaded PROJ.4 runtime: Rel. 4.7.1, 23 September 2009, [PJ_VERSION: 470]
Path to PROJ.4 shared files: (autodetected)
Error in .External2(C_loadhistory, file) : no history mechanism available
Calls: .First -> <Anonymous>
Execution halted

The downloaded source packages are in
‘/tmp/RtmpX42EEZ/downloaded_packages’
Warning message:
In install.packages("SuppDists") :
installation of package ‘SuppDists’ had non-zero exit status

有谁知道问题是什么?

最佳答案

Henrik 在 R-devel 邮件列表上给了我答案:

Using

if (interactive()) utils::loadhistory(file = "~/.Rhistory")

should solve your problem. The reason is that install.packages() in turn launches a non-interactive child R process that installs the package. When that process loads your startup file, it fails, because that function can only be used in interactive mode.

关于r - 加载 .Rprofile 时在 R 上安装包失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18240863/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com