R:安装包时出现问题(与目录名中的空格有关?)

标签 r windows install.packages

我正在尝试安装 CausalImpact 包,但由于对 bsts 的依赖性而失败。

我尝试安装 bsts 但没有成功,查看结果我发现我认为是 Boom 依赖项的失败:

install.packages("bsts", lib="C:/R/win-library/3.3")

Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘bsts’
Do you want to attempt to install these from sources?
y/n: y
installing the source package ‘bsts’

trying URL 'https://cran.rstudio.com/src/contrib/bsts_0.6.3.tar.gz'
Content type 'application/x-gzip' length 148815 bytes (145 KB)
downloaded 145 KB

* installing *source* package 'bsts' ...
** package 'bsts' successfully unpacked and MD5 sums checked
** libs

*** arch - i386
c:/Rtools/mingw_32/bin/g++  -std=c++0x -I"C:/PROGRA~1/R/R-33~1.0/include" -DNDEBUG -I`C:/PROGRA~1/R/R-33~1.0/bin/Rscript -e "cat(system.file(package='Boom'))"`/include -DNO_BOOST_THREADS -DNO_BOOST_FILESYSTEM -DADD_ -DR_NO_REMAP -DRLANGUAGE   -I"C:/Users/Firstname Lastname/Documents/R/win-library/3.3/Boom/include" -I"C:/Users/Firstname Lastname/Documents/R/win-library/3.3/BH/include" -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c aggregate_time_series.cc -o aggregate_time_series.o
g++.exe: error: Lastname/Documents/R/win-library/3.3/Boom/include: No such file or directory

我假设 g++ 正在变得不安,因为 R 已将库放在 C:Users/Firstname Lastname 的子文件夹中,并且它不喜欢我名字中的空格。

我尝试将 R_LIBS_USER 环境变量设置为 C:/R/win-library/3.3 以消除路径中有空格的问题,但没有成功 - 即使在完全重新启动计算机后,错误也会重复 -它仍然会转到 C:/Users/Firstname Lastname/Documents/R/win-library/3.3 目录。

我在 Windows 10 上使用 RStudio 0.99.896 和 R 3.3.0,如果这有什么不同的话

最佳答案

如本 related question 中所建议如果您不一定需要最新版本的 bsts,您仍然可以在 Windows 上安装版本 0.6.2,这样您就可以安装 CausalImpact:

install.packages("https://cran.r-project.org/bin/windows/contrib/3.2/bsts_0.6.2.zip", 
                  repos = NULL, type = "local")
library(devtools)
devtools::install_github("google/CausalImpact")

适用于 Win 10,R 3.3.0

关于R:安装包时出现问题(与目录名中的空格有关?),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37144856/

相关文章:

r - 从 R 中的列表中删除字符串向量

windows - 每个 Windows 操作系统的注册表中的 CurrentVersion 值

r - BiodiversityR 包加载失败

r - Win7 R 3.2.2 RStudio 0.99.473。安装 Hmisc 包时出错

Rgraphviz : edge labels outside plotting region

javascript - R 中的 Highcharts 依赖轮

java - 关于Java线程和进程优先级的一些问题

Python读取Windows命令行输出

npm - 全局安装具有对等依赖关系的 npm 包(package.json 中未提及)

R 和 getpwuid()