[R] Running R from the command line: weird problem

Duncan Murdoch murdoch.duncan at gmail.com
Fri Jul 13 18:59:33 CEST 2012


On 13/07/2012 9:46 AM, Abhi Raghavan wrote:
> Hi,
>
> I'm trying to run an R script from the command line and I do it in the
> following way:
>
> R CMD BATCH -q <something.R> <output file>*
>
> *I write the R script from inside a Perl program (on UNIX of course!)
> and execute the shell command using the function "system".**What
> intrigues me is the strange error that I see in the output file:
>
> Error: embedded nul in string: '\0'
> Execution halted

I would guess a likely cause of this is that there really are nuls in 
your something.R file.  Do you have a binary editor that can look at it?

There are lots of other possibilities too, e.g. something is writing out 
of bounds and putting nuls into strings in memory.  Those are likely 
harder to track down, so I'd look in the file first.

Duncan Murdoch

>
> When I copy and paste the commands manually in the R command prompt, I
> get exactly what I expect to get. I've never come across this error
> before. I did some brief searches on the net but cannot find any
> comprehensive on how this problem can be fixed. I would appreciate some
> help in the matter.
>
> As a general question, are there any mature Perl modules that help one
> interface R with Perl without having to resort to more cumbersome
> methods such as using system calls from within?
>
> Many thanks.
>
> Abhi
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list