[R] Passing multiple object names to a user-defined R fn XXXX

2013-10-14 Thread Dan Abner
Hi all, I am attempting to write an R fn that will accept multiple (but varying on how many) objects (usually data frames) as inputs and return summary output. What is the best way to pass the object names to the fn (I have thought of 2 options below) AND how do I then use the names inside the

Re: [R] Passing multiple object names to a user-defined R fn XXXX

2013-10-14 Thread PIKAL Petr
-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Dan Abner Sent: Monday, October 14, 2013 5:10 PM To: r-help@r-project.org Subject: [R] Passing multiple object names to a user-defined R fn Hi all, I am attempting to write an R fn that will accept multiple

Re: [R] Passing multiple object names to a user-defined R fn XXXX

2013-10-14 Thread Rui Barradas
Hello, You should put all those data frames in a list and then use the list (just one object). But if you have several objects in your workspace and need to write a function that accepts a varying number of arguments, use the dots argument: df.set - function(..., by){ dots -

Re: [R] Passing multiple object names to a user-defined R fn XXXX

2013-10-14 Thread Bert Gunter
A minor quibble. I would argue that R best practice would be to keep the summarization and printing separate; viz df.set - function(...){ dots - list(...) # all those objects in a list } On Mon, Oct 14, 2013 at 8:43 AM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, You should put

Re: [R] Passing multiple object names to a user-defined R fn XXXX

2013-10-14 Thread Bert Gunter
Sorry about the previous partial message. My email screwed up. Here's the complete message: df.set - function(...){ dots - list(...) # all those objects in a list lapply(dots,summary) } Cheers, Bert On Mon, Oct 14, 2013 at 8:59 AM, Bert Gunter bgun...@gene.com wrote: A minor