Thursday, August 23, 2007

Execute system commands within an R Script

To execute a system command from within an R script, just use system(). This is handy for zipping large output files on the fly.

write.csv(mydat, "mydat.csv")
system("gzip mydat.csv", wait=FALSE)

No comments: