[R] filling a vector with a tapply function applied to another vector

Petr PIKAL petr.pikal at precheza.cz
Fri Nov 12 14:45:31 CET 2010


Use ave instead of tapply. It is designed for such task

r-help-bounces at r-project.org napsal dne 12.11.2010 10:49:17:

> albechan <alberto.casetta at satt.biz> 
> Odeslal: r-help-bounces at r-project.org
> 12.11.2010 10:49
> Re: [R] filling a vector with a tapply function applied to another 
> The first column has 331 rows, the number of factors in the second 
column is
> 20 repeated in order to have 331 rows too. What I need is to reapeat in 
> third column each of the 20 results derived from
> tapply(firstcolumn,secondcolumn,mean) as many times as each factor 
> in the second column. So I'll have 331 values in the third column as 
> I hope it's clear enough what I need to do.
> -- 
> View this message in context: 
> with-a-tapply-function-applied-to-another-vector-tp3039271p3039337.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 
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list