简体   繁体   English

RWeka read.arff问题

[英]RWeka read.arff issues

I am reading a (sparse) arff using read.arff method of RWeka package. 我正在使用RWeka包的read.arff方法读取(稀疏)arff。 However I get the following error: 但是我收到以下错误:

Error in .jnew("java/io/FileReader", file) : 
  java.io.FileNotFoundException:  (No such file or directory)

The file I am trying to read in exists (file.exists('myfile.arff') return TRUE). 我尝试读取的文件存在(file.exists('myfile.arff')返回TRUE)。

My one line code is: 我的一行代码是:

data = read.arff(system.file('arff', 'myfile.arff', package='RWeka'))

Any ideas what might be going on? 任何想法可能会发生什么?

Thanks. 谢谢。

Edit 1: traceback() output 编辑1:traceback()输出

> traceback()
4: stop(list(message = "java.io.FileNotFoundException:  (No such file or directory)", 
   call = .jnew("java/io/FileReader", file), jobj = <S4 object of class "jobjRef">))
3: .External("RcreateObject", class, ..., silent = silent, PACKAGE = "rJava")
2: .jnew("java/io/FileReader", file)
1: read.arff(system.file("arff", "/home/andy/r/myfile.arff", 
   package = "RWeka"))

You seem to be using the format of the example in help(read.arff) without understanding why it is written using the system.file() function. 您似乎在help(read.arff)使用示例的格式,而没有理解为什么使用system.file()函数编写示例的格式。 If your .arff file is not in the package directory (and it does not appear to be so located), then you should not be using that function. 如果您的.arff文件不在软件包目录中(并且似乎不在此目录中),则您不应使用该功能。 Try instead: 请尝试:

mydat <- read.arff(file= "/home/andy/r/myfile.arff")

Or maybe just this if it is in your working directory: 或者,如果它在您的工作目录中,则可能只是这样:

mydat <- read.arff(file= "myfile.arff")

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

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