loadNamespace error loading choroplethr package in R [duplicate] - r

I'm new with R, and I'm having some trouble loading the car library. I use Windows 8.1 (64 bit) and i'm working in 32 bit R environment. I downloaded the library just fine, but when i try to load the car library using library(car) the message i get is:
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()),
versionCheck = vI[[j]]) :
there is no package called ‘quantreg’
Error: package or namespace load failed for ‘car’
This message came up asking for several other libraries besides quantreg. I downloaded some of those other libraries in the hope that it would be enough to run car, but it doesn't stop asking for more libraries.
Has anyone had the same issue? This also happened to some people I know, using different operating systems, mostly Windows, but also Linux.

It seems that you did not install the dependencies automatically when you installed car. I'm assuming that you tried installing with Rstudio, which does not automatically install dependencies.
This SO post and this one should help you to install them automatically.
Try reinstalling with the command install.packages("car",dependencies=TRUE).
Additionally, in the future you can check the CRAN page to see the depends, imports, suggests, etc.

Related

Problem in loading ggplot2 in R version 4.0

I have installed ggplot2 in R but when I try to load it, R gives this ERROR message:
library(ggplot2)
Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): namespace ‘rlang’ 0.4.6 is already loaded, but >= 0.4.7 is required
What should I do?
Thanks in advance.
Install the full tidyverse package, it will load all graphics dependencies include gglot2 and its dependencies too.
install.packages("tidyverse")
As mentioned here:
https://community.rstudio.com/t/i-cant-load-ggplot2-in-my-library-in-r-version-3-4-3/6466
I am working on WINDOWS OS and I had same problems with loading ggplot2 and other libraries. I tried to install it like it was suggested in other threads, but it didn't solve the problem. I found some similar issues in other topics, and i figured out that my Rstudio console wanted to have fresh a toolchain bundle called Rtools. It can be downloaded from CRAN REP.
You have to pick appripiote version for your Rengine version. If you do not know what version of R you have, you have to simple type R.version in console, and then download proper version of Rtools. After that, i updated every libraries in Rstudio. ggplot2, tidyverse and many other are working properly from that time
I hope that it could help somebody :)

R tells me I'm missing a dependency package when I'm not?

I have a handful of R scripts that I routinely run every day so all of the necessary packages have been running just fine for months. Yesterday I installed the RInno package and I believe this has somehow affected other packages because my routine scripts no longer run due to the inability to load my normal packages.
When troubleshooting I started with the odbc package. When trying to load it gives me:
Error: package or namespace load failed for ‘odbc’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘Rcpp’
I then ran .libPaths(), checked both of the returned paths, and the Rcpp package existed in both.
I've even tried re-installing both odbc and Rcpp with no luck. Does anyone know what could be going on here?
Update1: While trying to re-install Rcpp did not work, re-installing dplyr did manage to fix the missing rlang issue. So I decided to go download Rcpp directly from https://cran.r-project.org/web/packages/Rcpp/index.html and then paste it manually into both of my library folders. This seems to have fixed the Rcpp issue but I am now met with the following new error when trying to load odbc or run devtools::session_info():
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : object 'vI' not found
Update2: Ultimately I decided to do a restore on my two library folders to a time before I installed RInno and it seems to have worked. I still have no idea what RInno did but I won't be trying that again.

"Rcmdr" error load failed for ‘car’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):

I'm attempting to run 'Rcmdr' in R. I had it fully functional and accidentally exited the program. Now i can not get back in.
I've tried a number of things;
uninstall and reinstalling R
uninstall and reinstalling 'Rcmdr'
I tried manually installing
Trying different 'CRAN's
and all of the suggestions i saw from previous posts. (i.e.(install.packages("car",dependencies=TRUE)
Below is the error I'm receiving.
The downloaded binary packages are in C:\Users\william\AppData\Local\Temp\Rtmpuazyss\downloaded_packages
> library(Rcmdr)
Loading required package: RcmdrMisc
Loading required package: car
Error: package or namespace load failed for ‘car’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘openxlsx’
Error: package ‘car’ could not be loaded
A common cause of errors like this is that you are working on a system where you don't have write permission on the R package library. You install a package (likely openxlsx in this case), and since it can't write to the system library, it creates a private library for you somewhere where you do have write permission.
But then when you start a new session, it doesn't look in that location, so it thinks openxlsx is not installed, and you get an error like the one you saw.
A short term fix is to just re-install the missing package. But then you'll get the same error in the next session if you restart R.
A better fix is to tell R to look in your private library. You can find where it is after re-installing openxlsx by running
.libPaths()
The first entry in the result will probably be your private library, the second entry will be the standard system one. (You could have more than 2, but that's not likely unless you've already asked for more.) To make sure that your private library always shows up, you need to put the line
.libPaths("whatever was in the first entry")
into a file called .Rprofile in your home directory. For example, I see
> .libPaths()
[1] "/Users/me/R/contrib"
[2] "/Library/Frameworks/R.framework/Versions/3.5/Resources/library"
so I should have
.libPaths("/Users/me/R/contrib")
in my .Rprofile. You'll see some other directory there, use it.

Errors installing/loading package ‘adespatial’

I am trying to run the dbmem function on a large dataset using the adespatial package, but cannot get it to install. When I run install.package("adespatial), I get this message:
package ‘adespatial’ is available as a source package but not as a binary.
Why can't I install this package as a binary and how do I go about getting this package installed on my Mac (OS sierra version 10.12.6). I am running R studio with R version 3.1.2
Update
I also tried running
install.packages("adespatial",type = "source")
however when I try to load the library it still says the library is not found. There were also many errors in the install. I updated my version of R to 3.4.4 and now it will install with a few errors, but the library still will not come up.
When I attempt to load the library (library(adespatial)), I receive this error:
Error: package or namespace load failed for ‘adespatial’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called ‘curl’
Bit hard to replicate your problem, but try to install curl; either the R package:
install.packages("curl")
or directly on your OS (can't help there, sorry, never had an OS).
Anyway, if package installation fails in R, it throws an (or more) error message(s). In your case, they will point to missing packages. Rerun install.packages("adespatial") and see there.

Can't add 'genefilter' package to library

'genefilter' package was installed and working for me, however I'm not sure what I have done. I simply used:
library(genefilter)
as usual and I've gotten the error:
Error: package or namespace load failed for ‘genefilter’ in
loadNamespace(j<- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘RCurl’
I've uninstalled the package and have reinstalled using:
source("https://bioconductor.org/biocLite.R")
biocLite("genefilter")
but still receiving same error when I try to load it into my library. I have searched for answers and tried quite a few things but I can't figure it out. Any help would be appreciated as I have a tight deadline!
The correct method to handle an error saying that there is a missing package is to install the missing package.
The method you used usually does also install dependencies. However the authors of the package sometimes fail to include dependencies of dependencies. The installation of dependencies is not sufficiently recursive and you then need to make a separate installation. You may need to make several such "extra" installations. The network of dependencies is sometimes fairly deep. In this aspect is similar to the network of dependencies in varying tissue or cancer transcriptomes. You are a geneticist or student of genetics, right?
See that R is telling you the problem is with RCurl not genefilter.
It seems that the latest version of genefilter or one of its dependencies is dependant on RCurl.
install RCurl and see if that fixes it.

Resources