0
  1. Hello, could someone help me with this? I install the plm package, however, when I try to load it R gives me an error:

library(plm)

Output:

Error in library(plm) : there is no package called ‘plm’"

  1. About the installation of the package that is the output:

install.packages("plm")

Output:

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/be_al/OneDrive - UvA/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
also installing the dependency ‘collapse’


  There are binary versions available but the source versions are later:
         binary source needs_compilation
collapse  1.5.3  1.7.6              TRUE
plm       2.4-1  2.6-1             FALSE

  Binaries will be installed
tentando a URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/collapse_1.5.3.zip'
Content type 'application/zip' length 3842937 bytes (3.7 MB)
downloaded 3.7 MB

package ‘collapse’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\be_al\AppData\Local\Temp\Rtmp4gBL5q\downloaded_packages
installing the source package ‘plm’

tentando a URL 'https://cran.rstudio.com/src/contrib/plm_2.6-1.tar.gz'
Content type 'application/x-gzip' length 1652371 bytes (1.6 MB)
downloaded 1.6 MB

* installing *source* package 'plm' ...
** package 'plm' successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  namespace 'collapse' 1.5.3 is being loaded, but >= 1.6.0 is required
Calls: <Anonymous> ... namespaceImportFrom -> asNamespace -> loadNamespace
Execução interrompida
ERROR: lazy loading failed for package 'plm'
* removing 'C:/Users/be_al/OneDrive - UvA/Documents/R/win-library/3.6/plm'
Warning in install.packages :
  installation of package ‘plm’ had non-zero exit status

The downloaded source packages are in
    ‘C:\Users\be_al\AppData\Local\Temp\Rtmp4gBL5q\downloaded_packages’

3. From previous posts here I tried:

install.packages("plm", dependencies = TRUE)

but it still didn't work for me. And I also tried installing and loading multiple times but always get the same error.

  • 1
    Try installing RTools – Nad Pat Mar 26 '22 at 12:18
  • See how to [install Rtools](https://stackoverflow.com/a/62209748/6574038). Are you attempting to install the package on OneDrive? – jay.sf Mar 26 '22 at 12:20
  • if you are okay with installing slightly older version you can then use `install.packages("plm", type = "binary")`. As you show in your output, it does mention that binary versions are available (although older). – AdroMine Mar 26 '22 at 12:21
  • @NadPat I installed "Rtools42installer" from https://cran.r-project.org/, tried to install and load plm, again with the same error. – BernardoLA Mar 26 '22 at 13:47
  • @AdroMine when I tried your suggestion I get this error: "Package LibPath Version Priority Depends Imports LinkingTo Suggests Enhances License License_is_FOSS License_restricts_use OS_type Archs MD5sum NeedsCompilation Built" – BernardoLA Mar 26 '22 at 13:48
  • It seems like the installation halts because of an older version of the collapse package being installed (while a newer version is required). Try restart R and update the collapse package before launching the install.packages() call of plm – userq8957289475 Mar 26 '22 at 15:50
  • @BernardoLA you need to use Rtools 35, not rtools 42, for your R Version 3.6. – hyman Mar 27 '22 at 15:05
  • @BernardoLA: either use the Rtools 35 as suggested by hyman or update to a more recent version of R (currently the most recent is 4.1.2) so that CRAN will have pre-compiled binaries for you to install the usual way (your post is really about package 'collapse' as this contains compiled code while pkg 'plm' is plain R and has collapse as a hard dependency) – Helix123 Mar 29 '22 at 12:02
  • I appreciate all your help! Sorry for taking so long to get back to it. I re-installed the most recent version of R and I no longer get the error. Thank you very much guys! – BernardoLA Apr 11 '22 at 10:04

1 Answers1

0

Try: install.packages("plm",type="win.binary")

This must work