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

2012-09-12 Thread Trevor Davis
unction via, e.g. (from R commandline) > > >> > source('./foo.r') > > >> or otherwise loaded, then called, e.g. > > >> > foo(bar='baz') > > >> ? I'm looking for the 'R equivalent' of how python supports this

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 pro

Re: [R] getopt does not work as expected!

2012-03-30 Thread Trevor Davis
ter solution? The author of getopt started but did not finish adding positional arguments to ``getopt``. Howevor, positional arguments have been supported in the ``optparse`` package for over a year if you specify ``positional_args=TRUE`` to the ``parse_args`` function. - Trevor Davis

Re: [R] optparse::parse_args, using equals sign or not

2012-02-16 Thread Trevor Davis
> Hi > > We've found that when using parse_args(..., positional_arguments=FALSE), it > is permissible to invoke our script with either "--myfoo=bar" or "--myfoo > bar"; that is, whether or not the equals sign is present makes no > difference, and in fact both usage forms are demonstrated in the opt

Re: [R] ggsave in Linux

2010-02-24 Thread Trevor Davis
On Wed, Feb 24, 2010 at 1:28 PM, Ryan Garner wrote: > > I have a script that creates a qplot that is then saved as a .png file > which > works fine on Windows. But I also work on Linux servers via Putty and would > like to be able to create and save my plots to my working directory. Is > there a w

Re: [R] : source R-script interactively outside R

2009-10-30 Thread Trevor Davis
At least in the Unix version of the ``Rscript`` front-end to R (but oddly enough not ``R CMD BATCH``) you could put something like this in test.R: cat("Save workspace image? [y/n]: ") answer <- tolower( scan("stdin", "", n=1) ) if (substr(answer, 1, 1) == "y") { q("yes") } else { q("no"

Re: [R] Is there a 'vi' mode in R?

2009-08-07 Thread Trevor Davis
If you are using R in a *nix machine then R is usually compiled with support for gnu-readline which does have a vi mode. You need a file called ".inputrc" in your home directory containing the following line: set editing-mode vi in order to activate it. It works exactly like the vi

Re: [R] R book for economists

2009-08-07 Thread Trevor Davis
There is also Grant Farnsworth's "Econometrics in R" in the contributed documentation section of the R website: http://cran.r-project.org/doc/contrib/Farnsworth-EconometricsInR.pdf Best, Trevor Thiemo Fetzer wrote: Dear Group, I am an economics student starting with PhD work in London. As p

Re: [R] Pros and Cons of R

2008-05-27 Thread Trevor Davis
K. Elo wrote: Hi, Monica Pisica wrote: > - There is no perfect “beginner” book. How about - Crawley, Michael (2007). The R book, Wiley & Sons. - Maindonald, John & John Braun (2007): Data Analysis and Graphics Using R (2nd edition), Cambridge University Press. As a political scientist (with