Re: [R] Some unrelated questions.

2013-05-08 Thread Harry Mamaysky
R gives you facilities for doing this (using '...' and 'missing') without passing in a data.frame. For example, > foo <- function(arg1,arg2,...) { if (missing(arg1)) cat('missing arg1\n'); > print(list(...)) } > foo(1,2,arg3=3,arg4=4,arg5=5) $arg3 [1] 3 $arg4 [1] 4 $arg5 [1] 5 > foo(arg2=2

Re: [R] Some unrelated questions.

2013-05-07 Thread Keith S Weintraub
Jim, Thanks for your comments. KW -- On May 6, 2013, at 5:48 PM, Jim Lemon wrote: > see inline > > On 05/07/2013 02:14 AM, Keith S Weintraub wrote: >> Folks, >> >> I have been working on an R project that has a few dozen functions. >> >> I have some questions that are only tangentially re

Re: [R] Some unrelated questions.

2013-05-06 Thread Jim Lemon
see inline On 05/07/2013 02:14 AM, Keith S Weintraub wrote: Folks, I have been working on an R project that has a few dozen functions. I have some questions that are only tangentially related and might only be a difference in style. 1. Some of my functions take single-row data.frames as inpu

Re: [R] Some unrelated questions.

2013-05-06 Thread Bert Gunter
1. I would not presume to "advise" on good style. However, I will note that for your question (1) , default arguments and the "..." argument appears to be more standard. e.g. the function should be written as: myfunc(a1, a2, a3= something1, a4 = something2, ...) where arguments a1 and a2 are requ

[R] Some unrelated questions.

2013-05-06 Thread Keith S Weintraub
Folks, I have been working on an R project that has a few dozen functions. I have some questions that are only tangentially related and might only be a difference in style. 1. Some of my functions take single-row data.frames as input parameters lists. I don't force the user of the function to