R error: namespace load failed for ‘ggplot2’ - r

I needed to reinstall R after experiencing the blank non-functional Rstudio. After that I got into big troubles with Rstudio, which now would start but is reacting in a weird way. I installed many times ggplot2 and other packages, after which I am getting a message like:
package ‘ggplot2’ successfully unpacked and MD5 sums checked. The downloaded binary packages are in C:\Users\absolution\AppData\Local\Temp\RtmpIJr2z3\downloaded_packages
But when I upload them I am getting an error message:
Error: package or namespace load failed for ‘ggplot2’ in get(Info[i, 1], envir = env):cannot open file 'C:/Users/absolution/Documents/R/win-library/3.4/Rcpp/R/Rcpp.rdb': No such file or Directory
During this process I also observed twice a pop-up window asking if I would like to create a personal library, I clicked once no and the second time yes. So I dont know whats going on.
Here is what I got in the sessionInfo():
R version 3.4.4 (2018-03-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.4 tools_3.4.4 gtable_0.2.0 grid_3.4.4
I will highly appreciate your help.

Related

Package 'xxx’ was installed before R 4.0.0: please re-install it (already done fresh install and checked lib paths)

I am having some issue with installing a package in R 4.0.2 from binaries. Here is my attempt:
> install.packages("C:/Users/MNestor/Downloads/libSBML_5.18.0.zip", repos = NULL, type = "win.binary")
Installing package into ‘C:/Users/MNestor/Documents/R/win-library/4.0’ (as ‘lib’ is unspecified)
package ‘libSBML’ successfully unpacked and MD5 sums checked
Warning messages:
1: multiple methods tables found for ‘type’
2: multiple methods tables found for ‘type<-’
Next I load library:
> library('libSBML')
Error: package or namespace load failed for ‘libSBML’:
package ‘libSBML’ was installed before R 4.0.0: please re-install it
This error is confusing to me because I am working in R 4.0.2 and have clearly just done a fresh install.
I have tried
deleting the library folder and reinstalling
running remove.packages('libSBML') and reinstalling
For reference here are my library directories:
> .libPaths()
[1] "C:/Users/MNestor/Documents/R/win-library/4.0"
[2] "C:/Program Files/R/R-4.0.2/library"
The libSMBL folder is located in the first library path, and not the second (as expected).
Here is session info:
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] rsbml_2.46.0 BiocGenerics_0.34.0
loaded via a namespace (and not attached):
[1] BiocManager_1.30.10 compiler_4.0.2 tools_4.0.2 remotes_2.2.0
[5] stats4_4.0.2 SBMLR_1.84.0 graph_1.66.0
The error message is maybe a bit confusing, but it's saying the package is already compiled for an earlier version of R. (That's what the option "win.binary" means).
R 4.0 and earlier binaries are not compatible because of updated compilers and build tools.
You'll need to install the package from source, which likely means installing R tools (https://cran.r-project.org/bin/windows/Rtools/) or you'll need to use a version that is pre-built for R 4.0 or later.

package ‘rJava’ is in use and will not be installed

I have been using R for a while without problems. Just a sudden, i have several issues with Rjava errors. I searched online for clues, but found none.
The error is: Warning in install.packages :
package ‘rJava’ is in use and will not be installed
and now every time i run install.packages, i get a pop box that says uploading loaded packages.....
sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] miniUI_0.1.1.1 tabulizer_0.2.2 rJava_0.9-10
Every time i start RStudio, i get this error:
Loading required package: rJava
Error: package or namespace load failed for ‘rJava’ in exists(what, mode = "function", envir = ns):
reached elapsed time limit
I made sure that i had java versions for 64 bit and the environment was set correctly.
install.packages("rJava");library(rJava)
I want to have a solution so that rjava loads correctly when i start RStudio or install rjava
This looks like you are loading tabulizer on startup, which also loads rJava. I suspect the reason is that you have a file called .RDATA saved in your default working environment. That makes RStudio open and load it on starting. In that file, I suspect there is an object which needs tabulizer. This is why it is loaded on default and why you have these problems.
The solution is to delete or rename the .RDATA file. Use getwd() to find out your current working directory. You might need to make hidden files visible.

How to get ReporteRs to work after installing officer

I've been using the ReporteRs package to generate MS Word documents from R. Due to some Java problems, I tried the officer package as well. Ever since I installed officer, I am unable to load the ReporteRs package:
library(ReporteRs)
Loading required package: ReporteRsjars
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : there is no package called ‘officer’
Warning: Error in : package or namespace load failed for ‘ReporteRs’
I've tried deleting all three packages (both using pacman::p_delete() and by physically deleting the folders from my library) and reinstalling.
If I install all three packages, the error message is:
Error : object ‘ph_from_xml_at’ is not exported by 'namespace:officer'
Warning: Error in : package or namespace load failed for ‘ReporteRs’
I can't even find where this function is called from in ReporteRs or ReporteRsjars and I'm completely at loss as to how to go back to what worked.
Edit:
I've tried both using my (usual) microsoft R version, on which ReporteRs has worked before, and regular R 3.4.
sessionInfo():
R version 3.4.0 (2017-04-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=Danish_Denmark.1252 LC_CTYPE=Danish_Denmark.1252 LC_MONETARY=Danish_Denmark.1252 LC_NUMERIC=C
[5] LC_TIME=Danish_Denmark.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] compiler_3.4.0 tools_3.4.0
In the Microsoft client, the sessionInfo is
R version 3.3.3 (2017-03-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=Danish_Denmark.1252 LC_CTYPE=Danish_Denmark.1252 LC_MONETARY=Danish_Denmark.1252 LC_NUMERIC=C
[5] LC_TIME=Danish_Denmark.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RevoUtilsMath_10.0.0 RevoUtils_10.0.3 RevoMods_11.0.0 MicrosoftML_1.3.0 mrsdeploy_1.1.0 RevoScaleR_9.1.0
[7] lattice_0.20-34 rpart_4.1-10
loaded via a namespace (and not attached):
[1] codetools_0.2-15 CompatibilityAPI_1.1.0 foreach_1.4.3 grid_3.3.3 R6_2.2.2
[6] jsonlite_1.3 curl_2.3 iterators_1.0.8 tools_3.3.3 mrupdate_1.0.1

Getting an error in R - [Error: could not find function "qplot"]

Orginal R version
R version 3.2.2 (2015-08-14) -- "Fire Safety"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
> library(ggplot2)
Error in library.dynam(lib, package, package.lib) :
DLL ‘colorspace’ not found: maybe not installed for this architecture?
In addition: Warning message:
package ‘ggplot2’ was built under R version 3.2.3
Error: package or namespace load failed for ‘ggplot2’
> qplot(weights, prices, color = types)
Error: could not find function "qplot"
.... Hi got some issues running ggplot2, I'm trying to get through a basic online tutorial then the issue, was trying to run the qplot in one of the exercises then i got the errors as listed above, I've read around a bit on previous help lookups, went through the motions of:
install.packages("proto")
install.packages('ggplot2', dep = TRUE),
rebooting R - still getting the error. Any other "answer"?
#MLavoie, Mike Wise
> install.packages('ggplot2', dependencies = TRUE)
Installing package into ‘C:/Users/Sony/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/ggplot2_2.0.0.zip'
Content type 'application/zip' length 1977368 bytes (1.9 MB)
downloaded 1.9 MB
package ‘ggplot2’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Sony\AppData\Local\Temp\RtmpY97TTR\downloaded_packages
> library("ggplot2", lib.loc="~/R/win-library/3.2")
Error in get(Info[i, 1], envir = env) :
cannot open file 'C:/Users/Sony/Documents/R/win-library/3.2/scales/R/scales.rdb': No such file or directory
Error: package or namespace load failed for ‘ggplot2’
Session Info:
> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggplot2movies_0.0.1
loaded via a namespace (and not attached):
[1] colorspace_1.2-6 plyr_1.8.3 tools_3.2.3 gtable_0.1.2 Rcpp_0.12.3 grid_3.2.3 munsell_0.4.2
I had the same error after installing ggplot2. Two ways around this:
1) You need to load "library(ggplot2)" before you call qplot()
library(ggplot2)
qplot(factor(CLASS), VOLUME, data = abalone, geom = "boxplot")
2) I discovered randomly that adding "ggplot2::" in front of your code also makes it work, without calling the library.
ggplot2::qplot(factor(CLASS), VOLUME, data = abalone, geom = "boxplot")

R - unable to load devtools in R 3.2.0 under Windows XP 32 bit

When I try to load devtools in R
library(devtools)
I get a popup window that reports an msvcrt.dll error
RGui (32-bit) - [R Console]: Rgui.exe - Entry Point Not Found
The procedure entry point _chsize_s could not be located in the dynamic link library msvcrt.dll
and after closing the popup window, R reports the following error
Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'C:/Program Files/R/R-3.2.0/library/git2r/libs/i386/git2r.dll':
LoadLibrary failure: The specified procedure could not be found.
Error: package or namespace load failed for ‘devtools’
Here is the R sessionInfo
sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows XP (build 2600) Service Pack 3
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] rversions_1.0.0 RCurl_1.95-4.6 memoise_0.2.1 digest_0.6.8 bitops_1.0-6 XML_3.98-1.1
In my search for solutions, I found one post that is very similar and which currently has one answer that did not work for me.
Any help is greatly appreciated.
I could not install devtools running the latest RStudio and R (as of July 2015) versions on Windows XP SP3. Apparently the latest version of git2r does NOT support windows XP.
My workaround was to install R-3.0.3 and RStudios 0.98.1103. With these versions, install.packages("devtools") works as expected.

Resources