How do I deal with this Forcats install error

192 Views Asked by At

I downloaded r and now its refusing to import datasets because the package forcats is not installed. When I try to install it gives me this error:

install.packages("forcats") WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/ Installing package into ‘C:/Users/chimerab/OneDrive - IARC/Documents/R/win-library/3.6’ (as ‘lib’ is unspecified) also installing the dependencies ‘cli’, ‘lifecycle’, ‘rlang’

There are binary versions available but the source versions are later: binary source needs_compilation cli 2.5.0 3.6.1 TRUE lifecycle 1.0.0 1.0.3 FALSE rlang 0.4.11 1.1.1 TRUE forcats 0.5.1 1.0.0 FALSE

Binaries will be installed trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/cli_2.5.0.zip' Content type 'application/zip' length 534931 bytes (522 KB) downloaded 522 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/rlang_0.4.11.zip' Content type 'application/zip' length 1224139 bytes (1.2 MB) downloaded 1.2 MB

package ‘cli’ successfully unpacked and MD5 sums checked package ‘rlang’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in C:\Users\chimerab\AppData\Local\Temp\RtmpQ1lIAK\downloaded_packages installing the source packages ‘lifecycle’, ‘forcats’

trying URL 'https://cran.rstudio.com/src/contrib/lifecycle_1.0.3.tar.gz' Content type 'application/x-gzip' length 106854 bytes (104 KB) downloaded 104 KB

trying URL 'https://cran.rstudio.com/src/contrib/forcats_1.0.0.tar.gz' Content type 'application/x-gzip' length 294183 bytes (287 KB) downloaded 287 KB

  • installing source package 'lifecycle' ... ** package 'lifecycle' successfully unpacked and MD5 sums checked ** using staged installation ** R ** inst ** byte-compile and prepare package for lazy loading Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
    namespace 'rlang' 0.4.11 is being loaded, but >= 1.0.6 is required Calls: ... withCallingHandlers -> loadNamespace -> namespaceImport -> loadNamespace Execution halted ERROR: lazy loading failed for package 'lifecycle'
  • removing 'C:/Users/chimerab/OneDrive - IARC/Documents/R/win-library/3.6/lifecycle' Warning in install.packages : installation of package ‘lifecycle’ had non-zero exit status ERROR: dependency 'lifecycle' is not available for package 'forcats'
  • removing 'C:/Users/chimerab/OneDrive - IARC/Documents/R/win-library/3.6/forcats' Warning in install.packages : installation of package ‘forcats’ had non-zero exit status

The downloaded source packages are in ‘C:\Users\chimerab\AppData\Local\Temp\RtmpQ1lIAK\downloaded_package

1

There are 1 best solutions below

0
Captain Hat On

Try:

install.packages("rlang")
install.packages("forcats")

It sounds like forcats is installing dependencies rlang and lifecycle, but lifecycle's installation is failing because it requires a more up to date version of rlang. By explicitly installing rlang, you should be able to install forcats successfully.