Skip to content
Prev 4513 / 63424 Next

small inconistency: sapply & median (PR#702)

On Mon, 23 Oct 2000 jutans@utans.u-net.com wrote:

            
The apparent inconsistency is in
a2 
 2
[1] 1.5

which makes sense as in the first case the median is an element of the
input, and in the second it is not. Given that, sapply is doing perfectly
sensible things.  The prototype has an x <- as.vector(x) in its median,
and so strips the names from x. If you really want that, try

sapply(TMP.list, function(x) as.vector(median(x)))
item1 item2 
  2.0   1.5 

I suspect this is a feature, not a bug.