[R] Calling Function With Arguments In a Script

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Fri May 8 02:31:10 CEST 2015

I don't know what your work flow looks like, but I certainly do not equate "writing R with functions" to "passing parameters at the command line".  Rather, these seem quite orthogonal to me. I often have one R file of functions, and another R file where I source the first file and keep a record of various invocations of those functions as I identify which parameter values answer questions I have, and I copy those to an interactive R console session for testing. 

I would find the operating system command line an uncomfortable place to experiment with those parameter values because I often want to use R to repeatedly invoke those functions with range of values and then plot those results.

In fact, I can hardly imagine a scenario where I wanted to specify arguments when invoking my R script from the command line, since I can examine the status of the system clock, files and databases from inside R to determine what needed to be done next if I wanted to invoke a script automatically. I would only want to do that if I planned to call R from another scripting language, and I haven't needed to do that yet.
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
Sent from my phone. Please excuse my brevity.

On May 7, 2015 2:50:46 PM PDT, Rich Shepard <rshepard at appl-ecosys.com> wrote:
>On Thu, 7 May 2015, Clint Bowman wrote:
>> as in source("pairwise-plots-continuous-vars.R")
>   I did this before converting it to a function, when I modified the
>variables in the script. Did not try it as a function, should have.
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list