Error in rbind(info, getNamespaceInfo(env, “S3meth

2020-06-06 03:12发布

问题:

I'm trying to install the "factoextra" package using a local source tar ball on Windows. I can install other packages in the same way with no problem. However, when installing "factoextra", I get an error relating to S3methods.

I have tried using local windows binaries, installing the latest Rtools and made sure I have all the dependencies installed. I have also tried to use archived versions of the package.

install.packages('D:\\R_Packages\\Packages\\factoextra_1.0.5.tar.gz', repos = NULL, type="source")

* installing *source* package 'factoextra' ...
** package 'factoextra' successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
Error in rbind(info, getNamespaceInfo(env, "S3methods")) : 
  number of columns of matrices must match (see arg 2)
ERROR: lazy loading failed for package 'factoextra'
* removing 'D:/R-3.5.2/library/factoextra'
In R CMD INSTALL
Warning in install.packages :
   installation of package ‘D:/R_Packages/Packages/factoextra_1.0.5.tar.gz’ had non-zero exit status

I really just need this package to install.

回答1:

I found this thread: http://r.789695.n4.nabble.com/Error-in-rbind-info-getNamespaceInfo-env-quot-S3methods-quot-td4755490.html, which leads me to how I solved a similar issue on my machine.

I found that a broken version of the package was installed on my system and had to be removed manually before I could install a clean version.

Find if and where factoextra is installed (it might be on your system, just outdated or broken):

find.package("factoextra")

If it's there already (just broken), you can try to remove it with:

remove.packages("factoextra")

If remove.packages() fails even though find.packages() says the package is there, use the path returned by find.packages() to use your OS' file system to find and delete the package - just be careful only to delete stuff you know is broken.

Once the old, broken package is removed, use install.packages("factoextra") and it should work.

I had several packages that were broken in this way. If that's the case for you, you can identify which packages to remove and install this way by using something like:

allPackages <- installed.packages()[, 1]
findBrokenPackages <- function(packages) {
    for (p in packages) {
        tryCatch(ncol(asNamespace(p)$.__NAMESPACE__.$S3methods),
                 error = function(e) print(c(p, e)))
    }
}
findBrokenPackages(allPackages)

This will print out any packages that have the same issue. I would suggest removing all broken packages before trying to use install.packages() again.