0

I am trying to run a package written in java which calls out an R package 2.11 and I am getting this error:

> rm(list=ls())
> args <- commandArgs(TRUE)
> options(digits=7)
> 
> read.table(args[1],header=F)->x
Error in read.table(args[1], header = F) : no lines available in input
Execution halted

I wonder what is the problem, is it possible to change setting not to get this error?

MrFlick
  • 195,160
  • 17
  • 277
  • 295
  • Are you running this from the command line? The `commardArgs()` makes me thing you are but seeing the `>` makes me thing you are not. Are you passing a parameter when calling from the command line? What is the value of `args[1]`? Are you sure it points to a non-empty file on your computer? – MrFlick Aug 29 '18 at 17:32
  • Thank you MrFlick for your reply. In this case, R is being run by Java core, so I do not think it is being run from the command line but the location of R is written in bash_profile, which I think the Java core finds. I wonder where I could check in parameters where it points to? – Sergey_yaklichk Aug 29 '18 at 18:15
  • 1
    You could modify the R script to do `print(args[1])` before the `read.table` to try to see what it's pointing to. It's very unclear exactly how you are running this. It's not at all clear what the java portion is doing from your question. It's very difficult to help without a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – MrFlick Aug 29 '18 at 18:25

0 Answers0