[R] scripts with littler

John Lawrence Aspden news at aspden.com
Mon Jan 8 15:54:12 CET 2007


Thanks, that's a really neat mechanism, ( I especially like the note to vim,
which will save all my scripts having to end .R )

Is there any way to get at the command line and stdio though?

With littler I can do things like:

#!/usr/bin/env r

print(argv)
t=read.table(file=stdin())

so that I can write unix-style filters.

Cheers, John.



François Pinard wrote:


> I usually do something like:
> 
> 
> #!/bin/sh
> R --slave --vanilla <<EOF
> 
>    R script goes here...
> 
> EOF
> 
> # vim: ft=r
> 
> 
> If you need to search special places for packages, you may tweak
> exported environment variables between the first and second line.


-- 
Contractor in Cambridge UK -- http://www.aspden.com



More information about the R-help mailing list