Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in ls(envir = envir, all.names = private) : invalid 'envir' argument in R

I met with this error when I used a package in R for loading data, in this package, pakcage rJava was used.

Every time I run a function, the error is

Error in ls(envir = envir, all.names = private) : 
  invalid 'envir' argument

This package has been proved without any problem, just some environment problem in my computer.

when I debugged, I found that in the last process before ls(envir=envir,all.names = private ) the variable envir is NULL,which should be some value but not NULL I think.

After some trials, I kind of solved the problem, by installing rJava every time. And in addition, only when the error comes out, then I install 'rJava', it will work. If I install at the first, it won't work. So, I guess, installing 'rJava'(or probably installing packages), will cause some environment variables to change.

Either Java 7 and Java 8, including jdk or jre are tested, doesn't work. And for R, I am using the 3.1.3 R and all the packages are up to date.

Following is some information that I think may be useful for the troubleshooting.

By installing the package, jvm.dll needs to be added to the windows environment path: "Path" and I did that.

My sessionInfo is shown below:

R version 3.1.3 (2015-03-09)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

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] grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] rgdal_0.9-1            fields_8.2-1           spam_1.0-1             raster_2.3-33          sp_1.0-17              ecomsUDG.Raccess_2.2-6
 [7] downscaleR_0.5-2       maps_2.3-9             downscaleR.java_0.0-2  rJava_0.9-6            gWidgetsRGtk2_0.0-83   cairoDevice_2.22      
[13] RGtk2_2.20.31          gWidgets_0.0-54        R.utils_2.0.0          R.oo_1.19.0            R.methodsS3_1.7.0     

loaded via a namespace (and not attached):
 [1] abind_1.4-3       bitops_1.0-6      boot_1.3-15       CircStats_0.2-4   colorspace_1.2-6  dtw_1.17-1        lattice_0.20-30   MASS_7.3-39      
 [9] munsell_0.4.2     plyr_1.8.1        proxy_0.4-14      Rcpp_0.11.5       RCurl_1.95-4.5    scales_0.2.4      tools_3.1.3       verification_1.41

Thank you for any help you can provide.

like image 617
163 Avatar asked Mar 16 '15 14:03

163


1 Answers

Have u fully solved your issue? i had a similar issue just a few days ago, sorted it out and would like to share with the community. Actually those wrapper functions (in my case, Rbbg package) call rJava functions had a log file in your user folder under C drive, you could delete those log files as it will enable you to escape from the the error message.enter image description here

In my case, I need to delete the blpjavaapi0.log.0 and org.findata.blpwrapper.0 files created by Rbbg package.

like image 184
pidig89 Avatar answered Oct 28 '22 14:10

pidig89