« Analysis in R indicates "Moderately Strong Support" for fraud in Iranian election | Main | A statistical learning web service, in R »

June 19, 2009


TrackBack URL for this entry:

Listed below are links to weblogs that reference Batch mode in R: a primer:


Feed You can follow this conversation by subscribing to the comment feed for this post.

Most people run it from the command line?

I thought running R from scripts was the standard method. I can't imagine doing it any other way, even for simple things. It's just so much easier to type the command in a text editor, highlight it, and hit CTRL-R to run it.

I used to work in a computer lab, and one night I used 15 computers from the extra lab to run 15 different parts of my analysis simultaneously. The whirring hum of 15 processor fans hard at work for you is soothing. =)

I second that. I wouldn't even start a simple exploratory analysis directly from the interactive prompt -- how else are you going to keep track of what you're doing? And if you actually use R for work, and not just research, you'll be writing functions and calling them (and R itself) and generally scripting away as much as possible.

Still, good to link -- if anyone really does mostly run R interactively, they should see there is another way.

I use R that way too -- cut-n-paste from a script file is much faster that typing. That's still using R interactively though -- you're just automating the typing part :)

I'm surprised that in a discussion of batch mode in R there is no mention of R CMD BATCH. Certainly on Mac OS (which the author is using) and on Linux that is the preferred method of doing batch runs. Instead of

R --vanilla --slave < hello_world.R > result.txt

one would use

R CMD BATCH hello_world.R

I agree with Douglas Bates observation, ages ago I posted a basic tip about running R scripts in batch mode:



I would also recommend Rscript (v easy to run and also handle command line arguments). I've posted this suggestion back in more detail to the original blog too.

Good point Doug -- R CMD BATCH was a big omission! Thanks -- I feel a new post coming on...

Very informative article and thanks for sharing it. I think most easiest thing is that people can cut/paste R from file script rather than typing and this would easily run R and saves time.
For used desktops log on to http://www.electrocomputerwarehouse.com

The comments to this entry are closed.

R for the Enterprise

Got comments or suggestions for the blog editor?
Email David Smith.
Follow revodavid on Twitter Follow David on Twitter: @revodavid

Search Revolutions Blog