Re: [R] one way to write scripts in R

2010-03-29 Thread Muhammad Rahiz
I've been calling R from shell using the following (as example) ... #!/bin/bash for dir in $(ls *.txt); do R CMD BATCH script.R done Muhammad Tsjerk Wassenaar wrote: Hi, That seems quite neat. To make it a bit more flexible, and maybe do some argument acrobatics with bash, you could change

Re: [R] one way to write scripts in R

2010-03-29 Thread Jason E. Aten
Okay, I'll try again with .txt extension. Thanks David. On Mon, Mar 29, 2010 at 12:50 PM, David Winsemius wrote: > I would have made it through the mail-server had you given it an extension > of .txt but not so with the .rsh extension. > > > > On Mar 29, 2010, at 12:31 PM, Jason E. Aten wrote: >

Re: [R] one way to write scripts in R

2010-03-29 Thread Tsjerk Wassenaar
Hi, That seems quite neat. To make it a bit more flexible, and maybe do some argument acrobatics with bash, you could change the first few lines to something like #!/bin/bash exec R --vanilla -q --slave -e "source(file=pipe(\"sed -n /^##RSTART/,\$p $0\"))" --args $@ ##RSTART # Script here Ch

Re: [R] one way to write scripts in R

2010-03-29 Thread Jason E. Aten
Thanks Gabor. I didn't realize you could. Here is the scriptdemo.rsh file as a text attachment, in case the line wraps made it hard to read/use. - Jason On Mon, Mar 29, 2010 at 11:19 AM, Gabor Grothendieck < ggrothendi...@gmail.com> wrote: > Thanks. > > You might want to repost it as a text at

Re: [R] one way to write scripts in R

2010-03-29 Thread Gabor Grothendieck
Thanks. You might want to repost it as a text attachment since many of the lines wrapped around. Another more permanent possibility would be to put it on the R wiki at http://rwiki.sciviews.org/doku.php Note that the gsubfn package has a facility for quasi-perl type string interpolation as well.

Re: [R] one way to write scripts in R

2010-03-29 Thread Steve Lianoglou
Hi Jason, Thanks for sharing your solution(s). For other alternatives for running R scripts, you (or your colleague) might want to look into: * Rscript (comes installed with R (these days)) * littler (http://code.google.com/p/littler/) Also, there are some libraries that deal with parsing com