Deleted httr, now can't reinstall, or load devtools - r

I was trying to install twitteR, but the install failed, saying I needed httr >0.6 and I only had 0.3.
I tried to update httr. However, I seemed to have to 2 versions simultaneously, and when I used library(twitteR) it still said I had httr 0.3 and needed 0.6 (sorry I don't have the exact error messages anymore, and can't replicate due to the problems below.)
So, I deleted httr with remove.packages('httr') (this was a mistake).
Now I cannot load devtools
> library(devtools)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘httr’
Error: package or namespace load failed for ‘devtools’
or install packages
install.packages('httr')
'''Some lines skipped'''
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘httr’
Error: package or namespace load failed for ‘devtools’
Execution halted
I get the same error message as above when trying to install httr from a tarball with R CMD INSTALL.
I'm pretty stuck. Is it time for a clean R install?
And for future reference, how do I update httr?

My best guess -- you have something in your ~/.Rprofile that's attempting to load httr (or a package that uses httr) -- since surely, nothing in base R relies on httr.
I believe install.packages() launches an R sub-process (using the same arguments on load as the current session), which in turn will source that ~/.Rprofile, and cause the errors you are seeing.
If I am correct, one solution would be to move / comment out your ~/.Rprofile and restore it after re-installing httr. Alternatively, launching R with the --vanilla flag (to suppress any site / profile loading) should also help in alleviating the problem.

Running R as R --vanilla fixed the problem.
I could then install httr with
install.packages('httr')
And then loading devtools works and installing twitteR then works as well.

Related

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.

Issue installing Hmisc in Rstudio and calling in the library

I've had the following error for the package Hmisc. I read another thread which asked more about the error message however it said not to post this as a comment. I've installed the package and received the following error when calling in the library:
> library(Hmisc)
Error: package or namespace load failed for ‘Hmisc’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘checkmate’
In addition: Warning message:
package ‘Hmisc’ was built under R version 3.4.4
I've tried deleting the install and then installing checkmate separately and manually installing this from a browser rather than through R directly. However the same error message is returning. Does anyone know how to overcome this? Or similar packages to Hmisc. I need to package for a wtd.quantile function.
install.packages('lattice')
library('lattice')
install.packages('survival')
library('survival')
install.packages('Formula')
library('Formula')
install.packages('ggplot2')
library('ggplot2')
install.packages('checkmate')
library('checkmate')
install.packages('htmlwidgets')
library('htmlwidgets')
install.packages('stringi')
library('stringi')
install.packages('Hmisc')
library('Hmisc')

"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.

Trouble Installing and Calling R Package

I am trying to install the R package "rattle".
I do so by simply typing:
install.packages("rattle")
...upon which a lot of good installin' seems to take place. But then when I call the package
library(rattle)
I get the error message
Error: package or namespace load failed for ‘rattle’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘stringi’
All of the research I've done online suggests some form of
install.packages("rattle", insert_something_here)
but I've had no luck with such methods.
Any ideas on what I'm missing?
Ok, so the entire issue seemed to revolve around the stringi package.
I first installed the latest Rtools package from
https://cran.r-project.org/bin/windows/Rtools/
and then I was able to successfully install stringi manually
install.packages("stringi")
and then I could call rattle no problem.

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.

Resources