簡體   English   中英

如何在R中安裝“ rlang”包的特定版本?

[英]How to install specific version of “rlang” package in R?

我在Mac OS上使用R studio,並且想使用caret包進行一些數據分析。 但是, caret取決於rlang包,當我嘗試加載caret包時,出現此錯誤-

> library(caret)
Error: package or namespace load failed for ‘caret’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
 namespace ‘rlang’ 0.2.2 is already loaded, but >= 0.3.0.1 is required
In addition: Warning message:
package ‘caret’ was built under R version 3.4.4 

我從用戶界面中刪除了rlang程序包,並嘗試再次安裝它,但是我面臨以下問題-

> install.packages("rlang")
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.4/rlang_0.3.0.1.tgz'
Content type 'application/x-gzip' length 1074663 bytes (1.0 MB)
==================================================
downloaded 1.0 MB


The downloaded binary packages are in
    /var/folders/kh/9lkdq11x3sv56717v0700p_r_16f9p/T//RtmplrCvGX/downloaded_packages
> library(rlang)
Error in value[[3L]](cond) : 
  Package ‘rlang’ version 0.2.2 cannot be unloaded:
 Error in unloadNamespace(package) : namespace ‘rlang’ is imported by ‘tidyr’, ‘purrr’, ‘ggplot2’, ‘plotly’, ‘dplyr’, ‘tibble’, ‘pillar’ so cannot be unloaded
In addition: Warning message:
package ‘rlang’ was built under R version 3.4.4 

這是我的sessionInfo()

R version 3.4.3 (2017-11-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS  10.14

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] dummies_1.5.6       ISLR_1.2            mltools_0.3.5       data.table_1.10.4-3 ggplot2_3.0.0.9000  lattice_0.20-35    

loaded via a namespace (and not attached):
 [1] reshape2_1.4.3     purrr_0.2.4        colorspace_1.3-2   htmltools_0.3.6    viridisLite_0.3.0  yaml_2.1.16        plotly_4.8.0      
 [8] rlang_0.3.0.1      ModelMetrics_1.2.2 pillar_1.1.0       glue_1.2.0         withr_2.1.2        bindrcpp_0.2       foreach_1.4.4     
[15] bindr_0.1          plyr_1.8.4         stringr_1.2.0      munsell_0.5.0      gtable_0.2.0       htmlwidgets_1.2    devtools_1.13.4   
[22] codetools_0.2-15   memoise_1.1.0      curl_3.1           Rcpp_0.12.18       scales_1.0.0       jsonlite_1.5       digest_0.6.16     
[29] stringi_1.1.6      dplyr_0.7.4        grid_3.4.3         tools_3.4.3        magrittr_1.5       lazyeval_0.2.1     tibble_1.4.2      
[36] tidyr_0.7.2        pkgconfig_2.0.1    Matrix_1.2-12      assertthat_0.2.0   httr_1.3.1         iterators_1.0.10   R6_2.2.2          
[43] nlme_3.1-131       compiler_3.4.3     git2r_0.21.0 
  1. 也許嘗試一下-刪除rlang ,關閉並重新啟動R,然后重新安裝`rlang'。

  2. 如果您仍想安裝特定版本的rlang

    1)轉到https://cran.r-project.org/src/contrib/Archive/rlang/

    2)獲取所需的特定版本的URL。 (在Chrome上,右鍵單擊-復制URL等)

    3)啟動R, install.packages("[URL]", repo=NULL, type="source")
    例如install.packages("https://cran.r-project.org/src/contrib/Archive/rlang/rlang_0.2.2.tar.gz", repo=NULL, type="source")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM