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.
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)
``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:
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...
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
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)
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
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)
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
9 matches
Mail list logo