Re: [R] scripts with littler

2007-01-10 Thread John Lawrence Aspden
John Lawrence Aspden wrote: I've got a library (brainwaver), installed locally in ~/R/library, and this information is recorded in the ~/.Renviron file. In my script I load the library, but if I call it using #!/usr/bin/r --vanilla, this stops working. (Various private e-mails exchanged

Re: [R] scripts with littler

2007-01-10 Thread John Lawrence Aspden
Brian Ripley wrote: Exactly as documented. The argument is named 'new' and not 'add', BTW. Please 'be careful' in what you say about the work of others. Agreed, no criticism intended. I really like R. Sorry. Cheers, John. -- Contractor in Cambridge UK -- http://www.aspden.com

Re: [R] scripts with littler

2007-01-09 Thread John Lawrence Aspden
Guys, thanks very much for your help. Rscript looks great and I'll look forward to it. The /usr/bin/env thing seems to be a general difficulty with the mechanism. One's first thought has to be to modify env to parse and then pass the arguments in the expected way (maybe #!/usr/bin/env2?), and of

Re: [R] scripts with littler

2007-01-09 Thread John Lawrence Aspden
John Lawrence Aspden wrote: I'm actually tempted to use #!/usr/bin/env r rm(list=ls()) Ahem, it turns out to be better to use: #!/usr/bin/env r rm(list=ls()[ls()!=argv]) -- Contractor in Cambridge UK -- http://www.aspden.com __ R-help

Re: [R] scripts with littler

2007-01-09 Thread John Lawrence Aspden
Jeffrey Horner wrote: John Lawrence Aspden wrote: I'm actually tempted to use #!/usr/bin/env r rm(list=ls()[ls()!=argv]) Eww!! I'm not sure you want to do that. I would recommend sticking with: #!/usr/bin/r -v as that gives you a truer scripting environment. I understand

[R] scripts with littler

2007-01-08 Thread John Lawrence Aspden
Hi, I'm trying to write R scripts using littler (under Debian), and was originally using the shebang line: #!/usr/bin/env r However this picks up any .RData file that happens to be lying around, which I find a little disturbing, because it means that the script may not behave the same way on

[R] scripts with littler / subroutines

2007-01-08 Thread John Lawrence Aspden
Hi (again), Another difficulty I'm having is creating a common function (foo, say) to share between two scripts. I've tried making a third file containing the function and then sourcing it with source (foo.R), but that only works if you run the script in the directory where foo.R is. (or if the

Re: [R] scripts with littler

2007-01-08 Thread John Lawrence Aspden
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

Re: [R] scripts with littler / subroutines

2007-01-08 Thread John Lawrence Aspden
François Pinard wrote: [John Lawrence Aspden] Another difficulty I'm having is creating a common function (foo, say) to share between two scripts. In your previous message, you were telling us that you want to load from your home directory. You might put the common functions there, maybe

[R] littler+dget+stdin - segmentation fault

2007-01-04 Thread John Lawrence Aspden
Hi, I'm trying to write a series of pipes using littler, and I get the following behaviour: Sorry if I'm just doing something witless, I'm new to R. I'm using the latest versions from debian testing (2.4.0 and 0.0.8). $ r -e 'a-dget(file=stdin()); print(a)' ?list(a=2) Segmentation fault In R

Re: [R] littler+dget+stdin - segmentation fault

2007-01-04 Thread John Lawrence Aspden
Jeffrey Horner wrote: John Lawrence Aspden wrote: Hi, I'm trying to write a series of pipes using littler, and I get the following behaviour: $ r -e 'a-dget(file=stdin()); print(a)' ?list(a=2) Segmentation fault You've found a bug which has been fixed. Expect a new version 0.0.9