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
-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
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 -
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
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
5 matches
Mail list logo