I have a need to export some R data to formatted excel files and have successfully used both the XLConnect and xlsx packages in R before. I recently moved to 64 bit R and can't get either to work. I worked through some Oracle/Java architecture conflicts in a bunch of other packages. I am sure there is something similar going on here, but I can't crack it.
when I call library(XLConnect), rJava and XLConnectJars attach without issue.
Here is the error and session info:
> library(XLConnect)
Loading required package: XLConnectJars
Error : .onLoad failed in loadNamespace() for 'XLConnect', details:
call: .jfindClass(as.character(class))
error: class not found
Error: package or namespace load failed for ‘XLConnect’
> sessionInfo()
R version 3.3.1 (2016-06-21)
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] XLConnectJars_0.2-12
loaded via a namespace (and not attached):
[1] rsconnect_0.4.3 tools_3.3.1 rJava_0.9-8
I get a similar error when I try to attach xlsx.
> library(xlsx)
Loading required package: rJava
Loading required package: xlsxjars
Error : .onAttach failed in attachNamespace() for 'xlsx', details:
call: .jnew("org/apache/poi/xssf/usermodel/XSSFWorkbook")
error: java.lang.UnsupportedClassVersionError: Bad version number in .class file
Error: package or namespace load failed for ‘xlsx’
If I switch to 32 bit R, everything runs fine with both XLConnect and xlsx. I really need to run 64 bit R for other requirements.
Without getting into technicalities, you will need a 64-bit version of Java to go with the 64-bit version of R.
Even though this will solve the question you posted, I think you will be helped more by abandoning the Java-based XLConnect and xlsx-packages to connect to Excel. Instead, use the openxlsx-package. It does the same stuff (yes, also exporting formatted Excel sheets) as the other two, but doesn't rely on Java.
Besides not having the 64-bit/32-bit problem with Java, there are some advantages:
Firstly, while working with large tables you will not be confronted with OutOfMemoryErrors:
Error: OutOfMemoryError (Java): GC overhead limit exceeded.
Secondly, even when the Java-based packages don't show errors, it can take ages for them to work with large tables. openxlsx does not have these issues.
On a final and personal note: I was hesitant to switch between packages at first, but it solved all the things I disliked about the Java-based packages and the syntax is very similar.
Related
I am using Rstudio to load the package "later" running into the following error:
library(later)
Fehler: package or namespace load failed for ‘later’:
.onLoad in loadNamespace() für 'later' fehlgeschlagen, Details:
Aufruf: createCallbackRegistry(id, parent_id)
Fehler: Can't create event loop 0 because it already exists.
Loading the package using the RGUI works fine. Any suggestions what is causing the problem?
Furthermore, loading the package seems to work when I wait a couple of minutes after opening Rstudio.
I do not understand what kind of event loop might already exist.
It might be noteworthy that this problem seem to occur, when I work remote.
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 LC_MONETARY=German_Germany.1252 LC_NUMERIC=C LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] later_1.3.0
You get the message you saw if you try to run the later:::.onLoad function twice. That shouldn't happen normally, but it might happen if you load it, unload it, and load it again.
Given your comment that it works if you wait a couple of minutes, I'd guess that RStudio is loading it then unloading it, but there's some delay in the full unloading. I don't know if there's any way to affect this.
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.
I'm having this error when trying to attach package tidyselect and when trying to call tidyselect::any_function.
The error happens in Rstudio or command line alike, in RStudio it is triggered as soon as I type: tidyselect:: , though ?tidyselect:: works fine and I can call the help of ?tidyselect::any_function.
This also works:
packageVersion("tidyselect") # [1] ‘0.2.4
It used to work, and I don't understand what changed, I just know package rjava has been installed, the admins might also have changed something.
First a popup says:
The procedure entry point R_ContinueUnwind could not be located in the dynamic link library R.dll
Then an Error is displayed in the console :
Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object '//edited_UNC_path.com/edited_path/tidyselect/libs/x64/tidyselect.dll':
LoadLibrary failure: The specified procedure could not be found.
The dll file exists :
file.exists('//edited_UNC_path.com/edited_path/tidyselect/libs/x64/tidyselect.dll') # [1] TRUE
config :
sessionInfo()
R version 3.3.1 (2016-06-21)
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
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] 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] tools_3.3.1
Any idea how I can solve this ?
I don't know why this event happens as I am currently facing the same problem. Anyways I can explain your solution.
32 vs 64 bits
Your system is 64 bits, as shown in your sessionInfo(). i386 architecture is for the older systems, in 32 bits (they can only handle a limited amount of memory as they use 32 bits memory addresses, while 64 bits systems are, virtually, unlimited today).
What happens in R
A classic installation in R is "multiarch" for multi-architectures, which means 32 and 64 bits. In 64 bits systems there is no problem in building a 32 bits software. However, your may not have all the dependencies (e.g. C++ libraries) installed for both architectures. There is apparently a problem with your 32 bits installation. Then installing the package with INSTALL_opts="--no-multiarch" only installs the 64 bits version (the one you need), without problems.
This was solved by reinstalling tidyselect using :
install.packages("tidyselect",INSTALL_opts="--no-multiarch")
(Although the package could be install with install.packages("tidyselect") without error.
This answer pointed me to the solution (totally different question though).
It seems that it was indeed an issue with rjava.
Quoting the linked answer:
the solution was to use install option that simply forgets about i386 architecture. (also works with drat library and packages not from CRAN
It's all Chinese to me though and ?utils::install.packages doesn't help, I'll happily upvote / accept an answer that explains what's going on.
I have just enough experience with R to get some things done, but not enough to actually troubleshoot a problem like this. I also would not call myself a programmer, though at some point that would be great. In case it matters, I usually use Rstudio.
I am trying to solve a problem where I have different entries for the same sample (microsatellites with different runs) that I need to condense into one line of information for each sample. I found the perfect package to solve my problem (package = genomatic). The trouble is, that I could not install it for use with the most recent version of R because it was created before version 3.0. So I downloaded version 2.15.3 and am working with the regular bare bones console.
Genomatic was not available through the install packages list, so I downloaded a zip file for Windows from here: http://www2.uaem.mx/r-mirror/web/packages/genomatic/index.html
and then followed the directions from pages 6-7 in the manual (link below) to install it from my own machine.
http://people.oregonstate.edu/~knausb/software/Genomatic_users_manual_v05.pdf
It appeared to install just fine, however when I go to load the library, I get the following error:
> library(genomatic)
Loading required package: tcltk
Loading Tcl/Tk interface ... done
Error in library(genomatic) :
package ‘genomatic’ does not have a NAMESPACE and should be re-installed
I looked through the forum, but could not find an answer for how to fix this. Here is the session info:
> sessionInfo()
R version 2.15.3 (2013-03-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] tcltk stats graphics grDevices utils datasets methods
[8] base
Can somebody help me to make this work?
Thanks!
Liz
EDIT to add: I did try to reinstall, but ended up with the same results.
I'm not sure why you're getting this particular error, as the .zip file provided does appear to have a NAMESPACE file. Installing from source (which shouldn't require any extra installed tools, since the package has only R code, not any compiled [C++/C/FORTRAN] components) seems to help. You can either do this from the official CRAN archives:
library("devtools")
install_version("genomatic",version="0.0.7")
or from the old/frozen repository:
install.packages("genomatic",
repos="http://www2.uaem.mx/r-mirror/", type="source")
(My previous answer was wrong; there is a NAMESPACE file.)
Out of the blue my devtools package will not work. Here is what I get. I have tried numerous fixes on my Windows 8 machine. I have reinstalled Rtools, I have reinstalled devtools but I keep getting the follwoing
require(devtools)
Loading required package: devtools
Error in namespaceExport(ns, exports) :
undefined exports: iteratelist, rowSplit, whisker.escape, whisker.render
Where do I begin?
Winston Chang over on the devtools github said, "Strange, those errors involve the whisker package." So at his behest I am providing some additional information.
> packageVersion('whisker')
[1] ‘0.3.2’
> packageVersion('devtools')
[1] ‘1.3’
> sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
I found a solution. I deleted the whisker folder in ~My Documents\R\win-library\3.0\ and reinstalled the package. Everything worked.
Thanks to Winston Chang who made me realize that my devtools problems were coming from the whisker package which I believe devtools relies on. Thank you to #DWin who gave me the idea of chucking out a malfunctioning library and reinstalling the library.
It was when I issued library(whisker) that I realized the problem may not be with devtools at all but rather with whisker
> library(whisker)
Error in namespaceExport(ns, exports) :
undefined exports: iteratelist, rowSplit, whisker.escape, whisker.render
Error: package or namespace load failed for ‘whisker’
I can now load devtools and whisker.
It is odd. I would have thought that my packages would have been reinstalled when I uninstalled R and reinstalled it (one of the desperate steps I took when I was trying to troubleshoot). Evidently ~My Documents\R\win-library\3.0\whisker survived the uninstallation. Clearly I need to learn more about R installation and the ways in which the libraries can be setup.
My guess, in the absence of complete information and a log file for a command line installation, is that you have a corrupt .RData file. The .Rhistory file might alos be a source of corrupted data that results in incomprehensible error messages. (They are invisible to the average R user on both Windows and Mac file browsers.) Windows Explorer let's you choose to show hidden files. In WinXP one of the choices off the "Folder Options" dialog is the "View" panel. Delete first the .Rdata file and if that doesn't work then also delete the .Rhistory file.
My guess was wrong, so if RTools is available then:
install.packages("RGoogleDocs",
repos="http://www.omegahat.org/R", type="source")