How do I troubleshoot devtools - r

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

Related

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.

XLConnect: Attaching to 64 bit R

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.

Error: "package 'genomatic' does not have a namespace and should be reinstalled

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

Updating R in Windows

Following this post and also this link , I tried to update my R version .
sessionInfo()
R version 2.14.0 (2011-10-31)
Platform: i386-pc-mingw32/i386 (32-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
other attached packages:
[1] installr_0.9
loaded via a namespace (and not attached):
[1] tools_2.14.0
But when I ran the code
updateR()
Error in file(con, "r") : cannot open the connection
It shows exactly the same error while running the following command :
check.for.updates.R() # tells you if there is a new version of R or not.
Error in file(con, "r") : cannot open the connection
install.R() # download and run the latest R installer
Error in file(con, "r") : cannot open the connection
How can I update my R version ?
Per https://github.com/talgalili/installr/#troubleshooting,
Try running:
setInternet2(TRUE)
That worked for me when I was getting the below error message:
Error in file(con, "r") : cannot open the connection
The URLs of the installr package are probably out of date. Just go the R website and download the latest version.
You will have to reinstall your packages manually though, which can be a pain. You can use rownames(installed.packages()) in your old R to get a list of the packages you currently have installed so that when you go to your new R you can just work down the list and install them all again.
You could even do
sprintf('install.packages(%s)', paste(shQuote(rownames(installed.packages())),collapse=','))
and then copy-paste that command into your new R to try reinstall everything you had installed on your old R. I personally prefer though to just install them as I need them, so that if I had packages I no longer use in the old R, I don't bother to reinstall them on the new R unless I need them.
Also, the above may fail simply because your current R is quite old compared to the new R so some packages may no longer be compatible.

TeX package not installing in R version 3.1.0

I am trying to generate a pdf from .Rnw file using knitr package.
Please find the output of sessioninfo() below
R version 3.1.0 (2014-04-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
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
other attached packages:
[1] knitr_1.6
loaded via a namespace (and not attached):
[1] evaluate_0.5.5 formatR_0.10 stringr_0.6.2 tools_3.1.0
I have installed knitr but am unable to compile the code in the .Rnw file.
There is a popup that is saying "No TeX installation detected. Please install TeX before compiling". However both TeX and pdfLaTeX is not installing for this version of R, a warning message comes saying that TeX or pdfLaTex is not available.
Thanks in advance.
As a convenience, the installr R package is a very convenient way to install TeX--and a bunch of other useful stuff. Just run installr::installr() and pick MikTeX (at least). (Not sure if it works for non-Windows.)
Wrapping my comment into an answer. knitr uses pdflatex to generate a pdf. pdflatex is a part of TeX/LaTeX installation, which is not an R package and cannot be installed using R terminal (at least natively, because installr can actually do this, as indicated by #Gregor).
You need TeX installation on your machine to work properly with knitr. There are several options, with Miktex for Windows or TexLive for linux.
Take a look at the minimal example shipped with knitr. It starts with \documentclass{article}, which is a typical first line of a TeX file.
As a final note, R markdown can produce HTML using pandoc instead, so it does not require TeX and may be a good alternative if you prefer not to use TeX/LaTeX.
Step 1: Download and Install MiKTeX from http://miktex.org/2.9/setup
Step 2: Run
Sys.getenv("PATH")
in R studio This command returns the path where Rstudio is trying to find pdflatex.exe In windows (64-bit) it should return C:\Program Files\MiKTeX 2.9\miktex\bin\x64\pdflatex.exe If pdflatex.exe is not located in this location Rstudio gives this error code 41.
Step 3: To set this path variable run:
Sys.setenv(PATH=paste(Sys.getenv("PATH"),"C:/Program Files/MiKTeX 2.9/miktex/bin/x64/",sep=";"))

Resources