在运行R-3.4.4(在Windows 7和RStudio上)时:
install.packages("ggplot2", destdir = "C:/Program Files/R/R-3.4.4/library/temp")
我收到以下警告(大概是路径中的空格):
installing the source package ‘ggplot2’
trying URL 'https://cran.rstudio.com/src/contrib/ggplot2_3.2.1.tar.gz'
Content type 'application/x-gzip' length 3204655 bytes (3.1 MB)
downloaded 3.1 MB
Warning: invalid package 'C:/Program'
Warning: invalid package 'Files/R/R-3.4.4/library/temp/ggplot2_3.2.1.tar.gz'
Error: ERROR: no packages specified
In R CMD INSTALL
Warning in install.packages :
running command '"C:/Program Files/R/R-3.4.4/bin/x64/R" CMD INSTALL -l "C:\Program Files\R\R-3.4.4\library" C:/Program Files/R/R-3.4.4/library/temp/ggplot2_3.2.1.tar.gz' had status 1
Warning in install.packages :
installation of package ‘ggplot2’ had non-zero exit status
尽管如此,尝试使用以下方法来规避它:
install.packages("ggplot2", destdir = "C:/Temp")
导致:
* installing *source* package 'ggplot2' ...
** package 'ggplot2' successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called 'pillar'
其中
.libPaths()
[1] "C:/Program Files/R/R-3.4.4/library"
再次尝试通过以下方法解决该警告:
install.packages("pillar", destdir = "C:/Temp")
导致
** testing if installed package can be loaded
Fatal error: cannot open file 'C:\Users\Mary': No such file or directory
完整路径为C:\ Users \ Mary Surname \ etc \ etc ...,这使它回到第一个问题,即路径中“ FirstName”和“ Surname”之间存在空格。
任何纠正空间错误解释的方法。请注意,下载是可以的,但它属于尝试查找刚刚下载的zip文件的问题。