Skip to content

system()

2 messages · Dennis Fisher, Brian Ripley

#
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?
#
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: