简体   繁体   English

ls中的错误(envir = envir,all.names = private):R中的'envir'参数无效

[英]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. 当我在R中使用包来加载数据时,我遇到了这个错误,在这个包中,使用了pakcage rJava

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. 当我调试,我发现之前的最后一个过程ls(envir=envir,all.names = private )变量envirNULL ,这应该是一定的价值,但不为NULL,我想。

After some trials, I kind of solved the problem, by installing rJava every time. 经过一些试验,我通过每次安装rJava解决了这个问题。 And in addition, only when the error comes out, then I install 'rJava', it will work. 另外,只有当错误出现时,我才会安装'rJava',它会起作用。 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. 所以,我想,安装'rJava'(或者可能正在安装包)会导致一些环境变量发生变化。

Either Java 7 and Java 8, including jdk or jre are tested, doesn't work. Java 7和Java 8(包括jdk或jre)都经过测试,不起作用。 And for R, I am using the 3.1.3 R and all the packages are up to date. 对于R,我使用3.1.3 R并且所有包都是最新的。

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. 通过安装软件包, jvm.dll needs to be added to the windows environment path: "Path"然后我就这样做了。

My sessionInfo is shown below: 我的sessionInfo如下所示:

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. 感谢您提供任何帮助。

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. 实际上那些包装函数(在我的情况下,Rbbg包)调用rJava函数在C盘下的用户文件夹中有一个日志文件,你可以删除那些日志文件,因为它可以让你逃脱错误信息。 在此输入图像描述

In my case, I need to delete the blpjavaapi0.log.0 and org.findata.blpwrapper.0 files created by Rbbg package. 在我的例子中,我需要删除由Rbbg包创建的blpjavaapi0.log.0和org.findata.blpwrapper.0文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM