[R-sig-hpc] Oddities with system() and output redirection

Ross Boylan ross at biostat.ucsf.edu
Mon May 18 19:58:21 CEST 2009


system("hostname") returns a success (0) or error code and prints the
result of the command.
system("hostname", intern=TRUE) returns the string output of the
command.

I thought that the basic behavior was a product of the way I was running
R under OpenMPI, but it's just the documented behavior of system().  I
had overlooked this when running interactively because the  output
appears directly on the terminal.  So system("hostname) appears to work,
but r <- system("hostname") prints the hostname and sets r to 0.



More information about the R-sig-hpc mailing list