[R] error in using by + median

From: vito muggeo <vmuggeo_at_dssm.unipa.it>
Date: Fri, 02 May 2008 15:59:43 +0200


dear all,
Could anyone explain me the behaviour of median() within by()? (I am running R.2.7.0)

thanks,
vito

> H<-cbind(rep(0:1,l=20),matrix(rnorm(20*2),20,2))
> by(H[,-1],H[,1],mean)

INDICES: 0
         V1 V2
-0.2101069 0.2954377


INDICES: 1
          V1 V2
-0.23682173 -0.01225147
> by(H[,-1],H[,1],median)

Error in median.default(data[x, , drop = FALSE], ...) : need numeric data
>

-- 
====================================
Vito M.R. Muggeo
Dip.to Sc Statist e Matem `Vianelli'
UniversitÓ di Palermo
viale delle Scienze, edificio 13
90128 Palermo - ITALY
tel: 091 6626240
fax: 091 485726/485612
http://dssm.unipa.it/vmuggeo

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 02 May 2008 - 14:04:06 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 02 May 2008 - 14:30:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive