Re: [R] scripts with littler

From: Jeffrey Horner <>
Date: Tue 09 Jan 2007 - 19:52:41 GMT

John Lawrence Aspden wrote:
> 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"])

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 that won't load the libraries in your home area automatically, but consider the way scripts in other languages are written and distributed: they usually load the libraries at the beginning of the script. Silently loading them before the script is run hides behavior from the script user.

If you have libraries installed outside of the library search path, consider expanding it with .libPaths() before calling library() or require().




______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Wed Jan 10 07:28:47 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 09 Jan 2007 - 22:30:26 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.