Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install specific version of "rlang" package in R?

Tags:

r

I am using R studio on Mac OS and I want to use caret package for some data analysis. However, caret depends on rlang package and when I try to load caret package I get this error -

> 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 

I removed the rlang package from the UI and tried installing it again but I am facing below issue -

> 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 

Here is my 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 
like image 589
Regressor Avatar asked Dec 11 '22 04:12

Regressor


1 Answers

  1. Maybe try this -- Remove rlang, shutdown and restart R, and then reinstall `rlang'.

  2. If you still want to install a specific version of rlang,

    1) Go to https://cran.r-project.org/src/contrib/Archive/rlang/

    2) Get URL to the specific version you need. (On Chrome, Right click- Copy URL, etc)

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

like image 94
random user Avatar answered Jan 07 '23 07:01

random user