Re: [R] R equivalent of python module structure and functionality?

2012-09-14 Thread Martin Maechler
Jeff Newmiller jdnew...@dcn.davis.ca.us on Wed, 12 Sep 2012 14:57:38 -0700 writes: It is my normal practice to install R libraries without root. Just use your own library directory instead of the system library.

Re: [R] R equivalent of python module structure and functionality?

2012-09-12 Thread Tom Roche
https://stat.ethz.ch/pipermail/r-help/2012-September/323551.html (slightly edited) how to structure an R file such that it can be both 1. used as a script via, e.g., (from OS commandline) $ Rscript foo.r bar=baz 2. imported and called as a function via, e.g. (from R commandline)

Re: [R] R equivalent of python module structure and functionality?

2012-09-12 Thread Trevor Davis
``commandArgs`` is the function in base R that lets you access arguments passed to Rscript, does not allow any fancy parsing of options but if you are not able to install optparse it is better than nothing. - Trevor On Wed, Sep 12, 2012 at 1:32 PM, Tom Roche tom_ro...@pobox.com wrote:

Re: [R] R equivalent of python module structure and functionality?

2012-09-12 Thread Jeff Newmiller
It is my normal practice to install R libraries without root. Just use your own library directory instead of the system library. --- Jeff NewmillerThe . . Go Live...

[R] R equivalent of python module structure and functionality?

2012-09-11 Thread Tom Roche
summary: how to structure an R file such that it can be both 1. used as a script via, e.g., (from OS commandline) $ Rscript foo.r bar=baz 2. imported and called as a function via, e.g. (from R commandline) source('./foo.r) foo(bar='baz') ? I'm looking for the 'R equivalent' of how python

Re: [R] R equivalent of python module structure and functionality?

2012-09-11 Thread J Toll
On Tue, Sep 11, 2012 at 6:00 PM, Tom Roche tom_ro...@pobox.com wrote: summary: how to structure an R file such that it can be both 1. used as a script via, e.g., (from OS commandline) $ Rscript foo.r bar=baz 2. imported and called as a function via, e.g. (from R commandline)

Re: [R] R equivalent of python module structure and functionality?

2012-09-11 Thread Dirk Eddelbuettel
On 11 September 2012 at 18:47, J Toll wrote: | Maybe take a look at littler. | | littler provides hash-bang (i.e. script starting with #!/some/path) | capability for GNU R, as well as simple command-line and piping use. | | http://dirk.eddelbuettel.com/code/littler.html Thanks for the plug. I

Re: [R] R equivalent of python module structure and functionality?

2012-09-11 Thread Tom Roche
https://stat.ethz.ch/pipermail/r-help/2012-September/323551.html summary: how to structure an R file such that it can be both 1. used as a script via, e.g., (from OS commandline) $ Rscript foo.r bar=baz 2. imported and called as a function via, e.g. (from R commandline)

Re: [R] R equivalent of python module structure and functionality?

2012-09-11 Thread Trevor Davis
I also wanted to point Tom to CRAN packages getopt optparse written specifically to support command-line argument parsing with R Thanks, but again, I'm not seeing how those solve the given problem(s). Am I missing something? The optparse package, tested with Rscript but probably