如何安装没有管理员权限的R包?

时间:2015-04-27 15:58:01

标签: r

这是人们常常问的非常常见的问题。但是到目前为止,现有的答案都没有帮助我。 我正在使用Windows 7,我已经在我的机器上安装了R但是,我无法安装任何软件包。 我试图做,因为它是here

然而,对我而言,不仅编程文件被阻止,而且root我只能是user

例如,当我尝试安装软件包时,我得到以下内容

> install.packages("ggplot2")
--- Please select a CRAN mirror for use in this session ---
Warning: unable to access index for repository http://cran.mirror.garr.it/mirrors/CRAN/src/contrib
Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib
Warning: unable to access index for repository http://cran.mirror.garr.it/mirrors/CRAN/bin/windows/contrib/3.2
Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2
Warning messages:
1: In open.connection(con, "r") :
  unable to connect to 'cran.r-project.org' on port 80.
2: package ‘ggplot2’ is not available (for R version 3.2.0) 

如果我执行以下操作,我不确定是否真的安装了包

例如

> setInternet2(TRUE) 
> install.packages("devtools")
also installing the dependencies ‘mime’, ‘R6’, ‘bitops’, ‘brew’, ‘httr’, ‘RCurl’, ‘memoise’, ‘whisker’, ‘evaluate’, ‘rstudioapi’, ‘jsonlite’, ‘roxygen2’

trying URL 'http://cran.mirror.garr.it/mirrors/CRAN/bin/windows/contrib/3.2/mime_0.3.zip'
Content type 'application/zip' length 35053 bytes (34 KB)
downloaded 34 KB

trying URL 'http://cran.mirror.garr.it/mirrors/CRAN/bin/windows/contrib/3.2/R6_2.0.1.zip'
Content type 'application/zip' length 123320 bytes (120 KB)
downloaded 120 KB

trying URL 'http://cran.mirror.garr.it/mirrors/CRAN/bin/windows/contrib/3.2/bitops_1.0-6.zip'
Content type 'application/zip' length 36011 bytes (35 KB)
downloaded 35 KB

trying URL 'http://cran.mirror.garr.it/mirrors/CRAN/bin/windows/contrib/3.2/brew_1.0-6.zip'
Content type 'application/zip' length 104709 bytes (102 KB)
downloaded 102 KB

trying URL 'http://cran.mirror.garr.it/mirrors/CRAN/bin/windows/contrib/3.2/httr_0.6.1.zip'
Content type 'application/zip' length 388330 bytes (379 KB)
downloaded 379 KB

trying URL 'http://cran.mirror.garr.it/mirrors/CRAN/bin/windows/contrib/3.2/RCurl_1.95-4.6.zip'
Content type 'application/zip' length 2703282 bytes (2.6 MB)
downloaded 2.6 MB

trying URL 'http://cran.mirror.garr.it/mirrors/CRAN/bin/windows/contrib/3.2/memoise_0.2.1.zip'
Content type 'application/zip' length 16861 bytes (16 KB)
downloaded 16 KB

trying URL 'http://cran.mirror.garr.it/mirrors/CRAN/bin/windows/contrib/3.2/whisker_0.3-2.zip'
Content type 'application/zip' length 64626 bytes (63 KB)
downloaded 63 KB

trying URL 'http://cran.mirror.garr.it/mirrors/CRAN/bin/windows/contrib/3.2/evaluate_0.7.zip'
Content type 'application/zip' length 36884 bytes (36 KB)
downloaded 36 KB

trying URL 'http://cran.mirror.garr.it/mirrors/CRAN/bin/windows/contrib/3.2/rstudioapi_0.3.1.zip'
Content type 'application/zip' length 27315 bytes (26 KB)
downloaded 26 KB

trying URL 'http://cran.mirror.garr.it/mirrors/CRAN/bin/windows/contrib/3.2/jsonlite_0.9.16.zip'
Content type 'application/zip' length 1009930 bytes (986 KB)
downloaded 986 KB

trying URL 'http://cran.mirror.garr.it/mirrors/CRAN/bin/windows/contrib/3.2/roxygen2_4.1.1.zip'
Content type 'application/zip' length 598652 bytes (584 KB)
downloaded 584 KB

trying URL 'http://cran.mirror.garr.it/mirrors/CRAN/bin/windows/contrib/3.2/devtools_1.7.0.zip'
Content type 'application/zip' length 309378 bytes (302 KB)
downloaded 302 KB

package ‘mime’ successfully unpacked and MD5 sums checked
package ‘R6’ successfully unpacked and MD5 sums checked
package ‘bitops’ successfully unpacked and MD5 sums checked
package ‘brew’ successfully unpacked and MD5 sums checked
package ‘httr’ successfully unpacked and MD5 sums checked
package ‘RCurl’ successfully unpacked and MD5 sums checked
package ‘memoise’ successfully unpacked and MD5 sums checked
package ‘whisker’ successfully unpacked and MD5 sums checked
package ‘evaluate’ successfully unpacked and MD5 sums checked
package ‘rstudioapi’ successfully unpacked and MD5 sums checked
package ‘jsonlite’ successfully unpacked and MD5 sums checked
package ‘roxygen2’ successfully unpacked and MD5 sums checked
package ‘devtools’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
        C:\Users\ex3446\AppData\Local\Temp\RtmpOYDKSd\downloaded_packages

有什么建议吗?

2 个答案:

答案 0 :(得分:2)

我不认为这是写权限问题,正如其他人所评论的那样。我确保你的R环境被错误地设置正确(等等没有被破坏)。

同样通过阅读this,您可能需要在R可执行链接中设置标记--internet2,然后重试。

  

(a)在启动R时,使用标志--internet2或调用setInternet2(TRUE)启动R或将环境变量R_WIN_INTERNET2设置为非空值,以使用Windows Internet功能。

此外,您可以按如下方式指定install.packages以专门选择存储库:

install.packages("gains", repos = "http://cran.rstudio.com", type = "source")

答案 1 :(得分:0)

这是R-Studio的问题吗?我在使用R-Studio安装软件包时面临同样的问题。在尝试了所有对我不起作用的解决方案之后。我切换到R,我可以安装包。