I cannot load the LFE package - it gives me error

I cannot load the LFE package - it gives me this error. It is already loaded in the package space but when I write in my console "library(lfe)" it appears that. Can someone help me out or explain why this happens please? Thanks in advance

library(lfe)
Error: package or namespace load failed for ‘lfe’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘Formula’

Install the missing package

install.packages("Formula")

Thanks, but I tried and it gives me this when I tried to load the life package

library(lfe)
Error: package or namespace load failed for ‘lfe’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘sandwich’

I did what you said for "lfe" and it works now. When I loaded it appeared this "he downloaded binary packages are in
/var/folders/n1/vps_4_bd6tsbvnz8f88b08mr0000gn/T//Rtmp4MgH8F/downloaded_packages

library(lfe)".

Is that okay right?

This is the same problem but with a different package dependency, the solution is exactly the same.

install.packages("sandwich")

I tried to download the lfe package but without success. This is what I did:
install.packages("Matrix")
install.packages("lfe")
library(lfe)

When I tried to load it, it appears this error in my console:

library(lfe)
Loading required package: Matrix
Error: package or namespace load failed for ‘Matrix’ in get(method, envir = home):
lazy-load database '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Matrix/R/Matrix.rdb' is corrupt
Error: package ‘Matrix’ could not be loaded
In addition: Warning messages:
1: In .registerS3method(fin[i, 1], fin[i, 2], fin[i, 3], fin[i, 4], :
restarting interrupted promise evaluation
2: In get(method, envir = home) :
restarting interrupted promise evaluation
3: In get(method, envir = home) : internal error -3 in R_decompress1

Can you please help me with that?
Sorry for taking too much of your time and thanks in advance.

please run this again, and report the outcome

install.packages("Matrix")
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/Matrix_1.3-3.tgz'
Content type 'application/x-gzip' length 4924213 bytes (4.7 MB)
==================================================
downloaded 4.7 MB

The downloaded binary packages are in
/var/folders/n1/vps_4_bd6tsbvnz8f88b08mr0000gn/T//RtmpqMLzXE/downloaded_packages

This is what I received when I run "install.packages("Matrix")". What should I do next to use the LFE package?

what happens now when you do

library(Matrix) 

?

library(Matrix)
Error: package or namespace load failed for ‘Matrix’ in get(method, envir = home):
lazy-load database '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Matrix/R/Matrix.rdb' is corrupt
In addition: Warning messages:
1: In .registerS3method(fin[i, 1], fin[i, 2], fin[i, 3], fin[i, 4], :
restarting interrupted promise evaluation
2: In get(method, envir = home) :
restarting interrupted promise evaluation
3: In get(method, envir = home) : internal error -3 in R_decompress1

This happens

Can you restart your R session, Ctrl + Shft + F10 on windows, and try again

I am using R studio. Is it the same?

look in your Session menu on the topmost toolbar File,Edit, etc...

I am using a Mac. Ctrl + Shft + F10 does not work

Can you explain this to me? I am a beginner

Its quite possible I cant help you. as im not a Mac user.
Rstudio though should have many things similar. like the top menus.
Do you have a file menu?
do you have an edit menu?
do you have a Session menu?
if so, look for restart options in the session menu.

I think the weird thing in your case is that no errors show for Matrix on Install, but when you load the library it errors. Im thinking it might be helpful to restart your session, both before and after install.packages("Matrix"), before going on to the library(Matrix) step.

Yes, I have it.
What should I do? To restart.. "restart R.."?

Can you walk me though the process?

I clicked on restart R.
Then I loaded this again: getwd()
library(readxl)
library(tidyverse)
install.packages("lfe")

This was the response: etwd()
[1] "/Users/francescoproietti/## This is a markdown file"

library(readxl)

library(tidyverse)

install.packages("lfe")
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/lfe_2.8-6.tgz'
Content type 'application/x-gzip' length 1330483 bytes (1.3 MB)
==================================================
downloaded 1.3 MB

The downloaded binary packages are in
/var/folders/n1/vps_4_bd6tsbvnz8f88b08mr0000gn/T//RtmpzSTrvY/downloaded_packages

Then I clicked in the library to load it and this appears:

library(lfe)
Loading required package: Matrix

Attaching package: ‘Matrix’

The following objects are masked from ‘package:tidyr’:

expand, pack, unpack

Any suggestions? What should I do?

theres nothing especial to do, there is no problem. everything works fine.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.