[R] error in using by + median
vito muggeo
vmuggeo at dssm.unipa.it
Fri May 2 15:59:43 CEST 2008
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
More information about the R-help
mailing list