[R] system()

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Apr 12 09:09:35 CEST 2003


1) You didn't need to use unix() in S-PLUS.  Just

    cat("Finished with page", PAGENO, "\n")

which also works in R.

2) In R you could use

    system(paste("echo", "Finished with page", PAGENO))

this being a more standard way to produce output in Unix that creating a 
file and piping it to cat: but you could do that if you wanted to.
(That's exactly what unix(input="foo") does: list it to see.)

On Fri, 11 Apr 2003, Dennis Fisher wrote:

> I am new to R but have used Splus for many years.  When I create many 
> graphics in sequence in Splus/Linux, each time that I complete a 
> page, I send a message to my command line interface using the 
> following function:
> 
> FOOT <- function(PAGENO,TEXT)
>          {
>          mtext(outer=T, TEXT, side=1)
>          unix("cat", c(paste("Finished with page", PAGENO)),FALSE, FALSE)
>          }
> PAGENO <- PAGENO + 1
> FOOT(PAGENO,"Text")
> 
> In R, the corresponding function appears to be "system()".  I don't 
> see how I can pass the PAGENO argument to "cat" in R.
> 
> Any advice?
> 
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list