[R] aggregate and median

Petr Pikal petr.pikal at precheza.cz
Tue Dec 21 14:10:51 CET 2004



On 21 Dec 2004 at 12:46, Philippe HupĂŠ wrote:

> I am trying to use the function aggregate with the median function but
> I get the following error:
> 
> Error in FUN(X[[1]], ...) : Argument "INDEX"
> 
> When I replace median by mean, it works perfectly

Hi Philippe

I suppose that you have some typo in your aggregate construction 
or you redefined median.

> aggregate(x, list(rrr), mean)
   Group.1           x
1        1 -0.19455580
2        2 -0.06877719
3        3 -0.47657192
4        4 -0.41082682
5        5  1.27739323
6        6  1.15004620
7        7 -0.40064292
8        8 -0.02360514
9        9 -0.24954037
10      10  0.13480356
11      11  0.24179472
> aggregate(x, list(rrr), median)
   Group.1           x
1        1 -0.19455580
2        2 -0.06877719
3        3 -0.47657192
4        4 -0.41082682
5        5  1.27739323
6        6  1.15004620
7        7 -0.40064292
8        8 -0.02360514
9        9 -0.24954037
10      10  0.13480356
11      11  0.24179472

Works for me as supposed. Or do you do something completely 
defferent?

Cheers
Petr

> 
> Can someone tell me where the problem comes from?
> 
> Thx
> 
> 
> I am running R 2.0.0 on SunOS  5.9
> 
> -- 
> Philippe HupĂŠ
> UMR 144 - Service Bioinformatique
> Institut Curie
> Laboratoire de Transfert (4ème Êtage)
> 26 rue d'Ulm
> 75005 Paris - France
> 
> Email :  Philippe.Hupe at curie.fr
> TĂŠl :	 +33 (0)1 44 32 42 75
> Fax :  	 +33 (0)1 42 34 65 28
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
petr.pikal at precheza.cz




More information about the R-help mailing list