[R] sapply and median, possible or not ?

From: Ptit_Bleu <ptit_bleu_at_yahoo.fr>
Date: Fri, 07 Nov 2008 02:42:45 -0800 (PST)

Hello,

I have a list of data.frame
rowsplit : List of 15
$ (0,0.025] :'data.frame': 169 obs. of 7 variables:
$ (0.025,0.05]:'data.frame': 174 obs. of 7 variables:
$ (0.05,0.075]:'data.frame': 92 obs. of 7 variables:
$ (0.075,0.1] :'data.frame': 76 obs. of 7 variables:
$ (0.1,0.125] :'data.frame': 37 obs. of 7 variables:
$ (0.125,0.15]:'data.frame': 32 obs. of 7 variables:
$ (0.15,0.175]:'data.frame': 45 obs. of 7 variables:
$ (0.175,0.2] :'data.frame': 56 obs. of 7 variables:
$ (0.2,0.225] :'data.frame': 36 obs. of 7 variables:
$ (0.225,0.25]:'data.frame': 47 obs. of 7 variables:
$ (0.25,0.275]:'data.frame': 34 obs. of 7 variables:
$ (0.275,0.3] :'data.frame': 43 obs. of 7 variables:
$ (0.3,0.325] :'data.frame': 29 obs. of 7 variables:
$ (0.325,0.35]:'data.frame': 29 obs. of 7 variables:
$ (0.35,0.375]:'data.frame': 17 obs. of 7 variables:

And I would like to get a data.frame gathering the median value of each variable for each intervall.
as.data.frame(t(sapply(rowsplit, mean)) works well but I would prefer to use median but with sapply(rowsplit, median), I get the following message "Error in median.default(X[[1L]], ...) : need numeric data".

Any idea ?

Thanks in advance for your help,
Have a nice week-end,
Ptit Bleu.

PS :I'm under XP and use R2.7.2.

-- 
View this message in context: http://www.nabble.com/sapply-and-median%2C-possible-or-not---tp20378222p20378222.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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 07 Nov 2008 - 10:48:38 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 07 Nov 2008 - 11:42:53 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