Martin Maechler maech...@stat.math.ethz.ch
on Fri, 29 Apr 2011 16:25:09 +0200 writes:
Paul Johnson pauljoh...@gmail.com
on Thu, 28 Apr 2011 00:20:27 -0500 writes:
On Wed, Apr 27, 2011 at 12:44 PM, Patrick Burns
pbu...@pburns.seanet.com wrote:
Here are some data frames:
On Fri, Apr 29, 2011 at 9:25 AM, Martin Maechler
maech...@stat.math.ethz.ch wrote:
Paul Johnson pauljoh...@gmail.com
on Thu, 28 Apr 2011 00:20:27 -0500 writes:
On Wed, Apr 27, 2011 at 12:44 PM, Patrick Burns
pbu...@pburns.seanet.com wrote:
Here are some data frames:
I also favor deprecating mean.data.frame.
One possible exception would be for a single-column data frame.
But even here I'd say no, lest people expect the same behavior for
median, var, ...
Pat's suggestion of using stop() would work nicely for mean.
(but omit paste - stop handles that).
Tim
Paul Johnson pauljoh...@gmail.com
on Thu, 28 Apr 2011 00:20:27 -0500 writes:
On Wed, Apr 27, 2011 at 12:44 PM, Patrick Burns
pbu...@pburns.seanet.com wrote:
Here are some data frames:
df3.2 - data.frame(1:3, 7:9)
df4.2 - data.frame(1:4, 7:10)
df3.3 -
From: r-devel-boun...@r-project.org
[mailto:r-devel-boun...@r-project.org] On Behalf Of Martin Maechler
Sent: Friday, April 29, 2011 7:25 AM
To: Paul Johnson
Cc: r-devel
Subject: Re: [Rd] median and data frames
[ ... lots of lines elided ... ]
My vote is for deprecating mean.data.frame
My personal oppinion is that mean.data.frame() should never have
been written.
People should know, or learn, to use apply functions for such a
task.
The unfortunate fact that mean.data.frame() exists makes people
think that median.data.frame() should too,
and then
var.data.frame()
If Martin's proposal is accepted, does
that mean that the median method for
data frames would be something like:
function (x, ...)
{
stop(paste(you probably mean to use the command: sapply(,
deparse(substitute(x)), , median), sep=))
}
Pat
On 29/04/2011 15:25, Martin
This seems trivially fixable using something like
median.data.frame - function(x, na.rm=FALSE) {
sapply(x, function(y, na.rm=FALSE) if(is.factor(y)) NA else
median(y, na.rm=na.rm), na.rm=na.rm)
}
Paul Johnson pauljoh...@gmail.com 28/04/2011 06:20
On Wed, Apr 27, 2011 at 12:44 PM, Patrick
Here are some data frames:
df3.2 - data.frame(1:3, 7:9)
df4.2 - data.frame(1:4, 7:10)
df3.3 - data.frame(1:3, 7:9, 10:12)
df4.3 - data.frame(1:4, 7:10, 10:13)
df3.4 - data.frame(1:3, 7:9, 10:12, 15:17)
df4.4 - data.frame(1:4, 7:10, 10:13, 15:18)
Now here are some commands and their answers:
On Apr 27, 2011, at 19:44 , Patrick Burns wrote:
I would think a method in analogy to
'mean.data.frame' would be a logical choice.
But I'm presuming there might be an argument
against that or 'median.data.frame' would already
exist.
Only if someone had a better plan. As you are probably
On Wed, Apr 27, 2011 at 12:44 PM, Patrick Burns
pbu...@pburns.seanet.com wrote:
Here are some data frames:
df3.2 - data.frame(1:3, 7:9)
df4.2 - data.frame(1:4, 7:10)
df3.3 - data.frame(1:3, 7:9, 10:12)
df4.3 - data.frame(1:4, 7:10, 10:13)
df3.4 - data.frame(1:3, 7:9, 10:12, 15:17)
df4.4 -
11 matches
Mail list logo