It seams that upon installing my custom R package code stops to work? Why?
In detail, I have a tiny R package goEnrichment (click to see the Github repo). The R package includes just just two functions and some binary data.
Also there are two test R-scripts that I run after installing the R package with R CMD INSTALL goEnrichment. One test script fails while the other works.
The only difference between the two scripts is that in the working version I require the necessary libraries and source the functions file manually, while in the other failing script I require my goEnrichment library directly.
Note, that both scripts are started directly from their directory goEnrichment/exec.
Start the working test with cd goEnrichment/exec && Rscript testGoEnrichment_works.R. Excerpt:
# This is the WORKING version
require(GOstats)
require(GSEABase)
require(RMySQL)
source( "../R/goEnrichment.R" )
Start the failing test script with cd goEnrichment/exec && Rscript testGoEnrichment_fail.R. Excerpt:
# This version FAILS
require(goEnrichment)
The error I get is somewhat uninformative to me:
'dimnames' applied to non-array.
The built R package fails on two platforms, that is on Debian Wheezy 64 with R 3.0.2 and on Mac OS X Yosemite with R 3.1.1.
I really have no clue why this happens. I checked for file format and unexpected characters using Vim. The cause does not seem to be the DESCRIPTION file either, because all libraries, goEnrichment depends on, are imported.
Does any one have a clue what causes this very weird error? Help will be much appreciated.
After much testing I found the source of the problem.
For some reason when requiring my package with
require(goEnrichment)
the generic function
summary.GOHyperGResult
is not loaded, as it should be. The method however is available when the packages, goEnrichment depends upon, are required manually. As to why this is, I had no time to investigate. I believe the here reported error is related to this bug.
Thanks to Tyler for your efforts, very much!
Related
I am trying to embed RInside to my application on win7 64-bit system but when I initialize an RInside:
Rin = new RInside(argc, argv);
the following message appears:
Error in loadNamespace(name) : there is no package called 'Rcpp'
This error only occurs with Windows.
I think you get that issue when your .libPaths() differ--in other words run the .libPaths() function to see the paths stored by R for its use. Then check where RInside is installed, and make sure Rcpp is installed there too. It is a setup issue.
In other words, it should work if you have Rcpp and RInside installed where the basic R libraries are. Otherwise you have to tell the (embedded) R session about the other location (and before it starts).
There are more Windows users on the list, so you could try asking on rcpp-devel.
First get your default library locations by command ".Library" in R.
Get Rcpp package from https://cran.r-project.org/web/packages/Rcpp/index.html.
Unzip and copy folder "Rcpp" to your default library locations obtained from step1.
Now you are ready to install packages which have dependencies on Rcpp.
Dirk is right in this case, BUT if the .libPaths() does not work, then please also check if you have the latest packages.
I am posting this as an ancillary answer backup which I ran into with the shiny package backend switch of their code needing Rcpp!
In this case of getting the "no package" error message, I fixed it by:
Selecting devtools package and then using this line below. (if you don't have devtools then get it with install.packages("devtools")
devtools::install_github("rstudio/shiny")
The development version of the package handled this better, and added the package as a dependency.
Mods - I realize this is an answer to an old question, but I might help others not wasting an hour like I just did.
You might find it easy if the answers are for both R studio users and non R studio users.
R Studio users
First get your default library locations by command ".Library" in R.
Get Rcpp package from https://cran.r-project.org/web/packages/Rcpp/index.html.
Unzip and copy folder "Rcpp" to your default library locations obtained from step 1, you will find another folder named library, paste the unzip folder in it.
Non R studio Users
First get your default library locations by command ".libPath" in R.
Get Rcpp package from https://cran.r-project.org/web/packages/Rcpp/index.html.
Unzip and copy folder "Rcpp" to your default library locations obtained from step 1, you will find another folder named library, paste the unzip folder in it.
I was also getting this error while trying to run the 'ggplot' function from the ggplot2 package. After trying the suggestions posted here and elsewhere (checking file paths, restarting R, clearing out my environment, etc.) and encountering several other cryptic error messages, it turned out that I needed to download the latest version of base R for Windows (v3.4.1) and update my version of R-Studio to the latest version also (v1.0.153).
After doing this my 'ggplot' function was working again and I was able to render my figure from R Studio without any further issues.
I was also getting this message when trying to use ggplot. I first updating both my R for Windows to 3.4.3. Then updating R studio to version 1.1.423; then, updating all of the packages and being sure to access the R version 3.4.3 from R studio, I still got the message. None of these things fixed the error. I was ready to give up until I noticed that I was calling library(ggplot) and had ggplot::ggplot in my code. THIS WAS THE PROBLEM. I changed it to library(ggplot2) and the instance to ggplot2::ggplot(...). THIS FIXEd the problems.
I was facing a similar issue, and I simply installed the said package. It's working perfectly for me.
After changing all the needed environment varaibles ( Control Panel/ System/Advanced system settings/Environment Variables) in windows 8, when I am installing rJava Package I get errors as below
I tried in MsDOS immediately after changing environment variables,
first step >R "it was successful"
second >install.packages("rJava") "got error in this step"
then I tried >install.packages("rJava", repos="https://cran.rstudio.com/") "but again I did not succeeded"
I am tired of trying all this, I referred many links already but all in vain. Yes, I am using Proxy also. Please help any one.
1) It seems a download problem first. So do this:
Download rJava_0.9-8.zip from CRAN (cran.r-project.org/web/packages/rJava/index.html). Then, in Revolution R Enterprise; Packages - "Install Packages From local Zip Files..." - Choose rJava_0.9-8.zip - OK. If the problem is solved then OK.
If the problem persists, try the following Step.
2) Look at DESCRIPTION file in rJava (in library location):
Package: rJava
Version: 0.9-8
....
Depends: R (>= 2.5.0), methods
....
NeedsCompilation: yes
Your R version may be incompatible. Look at the warning: "rJava is not available for R3.3.0" in your screenshot. So do this:
Unzip file rJava_0.9-8.zip to R's working directory; the folder rJava is created there. Change R version accordingly (you may introduce lower version number in Depends section). Save the changed DESCRIPTION file. Apply classical procedure:
library(roxygen2) # install this package first if not done yet
library(devtools) # install this package first if not done yet
library(digest) # install this package first if not done yet
Note: Since rJava folder is created manually, no package.skeleton is needed at this stage.
roxygenize("rJava")
build("rJava")
install("rJava")
The above technique must solve the problem (It solved previously many R version problems!).
Analyze this one also:
Install a specific release of bioconductor package (where the solution I wrote solved the problem of the questioner).
If you still have problems, trigger the following:
sessionInfo(); getwd(); .libPaths()
and print the output in your question so that we can analyze if you have any machine-spesific or installation-spesific problems.
I am using 32-bit R 3.1.2 on Windows 7.
I recently conducted an R CMD check --as-cran on a recently-developed package and received only the 'New submission' note. Research here and on R-devel suggested this could be ignored. I also used devtools::build_win() and received no notes or warnings, other than the one mentioned previously. Further, I built the package locally with R CMD build and R CMD INSTALL --build and everything worked as it should, including the PDF manual.
Upon submission to CRAN, I was told that a warning was thrown:
This fails to make its manual:
* checking PDF version of manual ... WARNING
LaTeX errors when creating PDF version.
This typically indicates Rd problems.
LaTeX errors found:
! Missing $ inserted.
<inserted text>
$
l.682 }{}
! Missing } inserted.
<inserted text>
}
l.682 }{}
...
The line appears to be
\widehat{R_1} = \frac{\sum\limits_{i=1}^n{c_i/n}}{\sum\limits_{i=1}^n{L_i/n}}
Additional research here suggests that I use win-builder.r-project.org/ to check my package on the development version and results from that test threw only the "New submission" warning.
I'm at loss. I can't replicate the error that CRAN found an everything appears to work correctly on my machine and on win-builder.r-project.org, too.
Can someone please help me with resolving this issue? I freely admit that I am not a LaTeX expert but given that the line wasn't an issue with R 3.1.2 on windows or the development version on win-build, I don't know where to begin.
Package information is available here:
creelSurvey
I used the inlinedocs package to write my functions and comments. The warning is coming from the .R, line 127:
this function
and the .Rd line 39:
this .Rd
Thanks for your help.
I was able to reproduce this problem on Ubuntu 12.04 with r-devel by cloning the Github repo and running
R CMD build creelSurvey
R CMD check --as-cran BusRouteCreelSurvey_0.2.1.tar.gz
I was able to fix it by removing DOS end-of-line markers (^M or Ctrl-M) from man/SimulateBusRoute.Rd. I don't know the easiest way to do this on Windows (you could look for a dos2unix utility, or possibly come up with a readLines solution.
I don't know how it will work across platforms, but this seems to work for me:
fn <- "MakeAnglers.Rd"
r <- readLines(fn)
writeLines(r[nchar(r)>0],con="new.Rd")
I would (1) look for (possibly obscure) warnings in the R Extensions manual about end-of-line markers and then (2) report this, either to the CRAN maintainers or by posting on r-devel#r-project.org.
In general you should be able to detect these problems if you can set up a test build on a Linux system; I don't know of an equivalent of win-builder.r-project.org for Linux systems, but http://travis-ci.org is a good resource, and this Github project is a good way to get started with R projects on Travis. (Or you can set your project up on R-forge.) I recognize that this might be more of a project than you're looking for right now, just including it for future reference.
I am trying to embed RInside to my application on win7 64-bit system but when I initialize an RInside:
Rin = new RInside(argc, argv);
the following message appears:
Error in loadNamespace(name) : there is no package called 'Rcpp'
This error only occurs with Windows.
I think you get that issue when your .libPaths() differ--in other words run the .libPaths() function to see the paths stored by R for its use. Then check where RInside is installed, and make sure Rcpp is installed there too. It is a setup issue.
In other words, it should work if you have Rcpp and RInside installed where the basic R libraries are. Otherwise you have to tell the (embedded) R session about the other location (and before it starts).
There are more Windows users on the list, so you could try asking on rcpp-devel.
First get your default library locations by command ".Library" in R.
Get Rcpp package from https://cran.r-project.org/web/packages/Rcpp/index.html.
Unzip and copy folder "Rcpp" to your default library locations obtained from step1.
Now you are ready to install packages which have dependencies on Rcpp.
Dirk is right in this case, BUT if the .libPaths() does not work, then please also check if you have the latest packages.
I am posting this as an ancillary answer backup which I ran into with the shiny package backend switch of their code needing Rcpp!
In this case of getting the "no package" error message, I fixed it by:
Selecting devtools package and then using this line below. (if you don't have devtools then get it with install.packages("devtools")
devtools::install_github("rstudio/shiny")
The development version of the package handled this better, and added the package as a dependency.
Mods - I realize this is an answer to an old question, but I might help others not wasting an hour like I just did.
You might find it easy if the answers are for both R studio users and non R studio users.
R Studio users
First get your default library locations by command ".Library" in R.
Get Rcpp package from https://cran.r-project.org/web/packages/Rcpp/index.html.
Unzip and copy folder "Rcpp" to your default library locations obtained from step 1, you will find another folder named library, paste the unzip folder in it.
Non R studio Users
First get your default library locations by command ".libPath" in R.
Get Rcpp package from https://cran.r-project.org/web/packages/Rcpp/index.html.
Unzip and copy folder "Rcpp" to your default library locations obtained from step 1, you will find another folder named library, paste the unzip folder in it.
I was also getting this error while trying to run the 'ggplot' function from the ggplot2 package. After trying the suggestions posted here and elsewhere (checking file paths, restarting R, clearing out my environment, etc.) and encountering several other cryptic error messages, it turned out that I needed to download the latest version of base R for Windows (v3.4.1) and update my version of R-Studio to the latest version also (v1.0.153).
After doing this my 'ggplot' function was working again and I was able to render my figure from R Studio without any further issues.
I was also getting this message when trying to use ggplot. I first updating both my R for Windows to 3.4.3. Then updating R studio to version 1.1.423; then, updating all of the packages and being sure to access the R version 3.4.3 from R studio, I still got the message. None of these things fixed the error. I was ready to give up until I noticed that I was calling library(ggplot) and had ggplot::ggplot in my code. THIS WAS THE PROBLEM. I changed it to library(ggplot2) and the instance to ggplot2::ggplot(...). THIS FIXEd the problems.
I was facing a similar issue, and I simply installed the said package. It's working perfectly for me.
When I run the commands library(forecast) and library(RcppArmadillo), there is no error. However, when I try to run these commands from a script, my script is unable to execute.
There are a few nuances to this case. Firstly, I only encounter this error on machines with R version > 2.14. I successfully ran this script on R 2.13.0, and encountered the error on machines with R version 2.14.1 and 2.14.2.
Additionally, the command find.package("forecast"), and similarly find.package("RcppArmadillo") does not return an error from inside the script, meaning that the script can locate the packages but cannot load them.
I have successfully ran a script replacing library(forecast) with the following 6 other packages: Rcpp, tseries,fracdiff,qcc,quadprog, zoo, and parallel.
Does anyone know why I cannot load these two packages from a script even though I can load them in the R console, and why this error occurs only for R versions > 2.14? My initial thought was that it might be related to the fact that these packages depend on R>=2.14.
Thank You Very Much.
We found that the issue was that RcppArmadillo depends on the Rlapack.dll file, which the script was not able to locate when loading the library. The solution was to copy the Rlapack.dll file to the library/RcppArmadillo/libs/i386 subfolder. After making this change, we were able to successfully execute our script.
We have two questions about this issue.
1) Why, when executing via R console, were we able to locate the Rlapack.dll file, when, during script execution, we were unable to find the dependent file?
2) Why did this issue occur only in R > 2.14? Was this a result of an update to either the RcppArmadillo or forecast packages?