[R] filling a vector with a tapply function applied to another vector
santosh.srinivas at gmail.com
Fri Nov 12 09:54:41 CET 2010
You could just create a new data frame with the result and cbind?
On Fri, Nov 12, 2010 at 2:11 PM, albechan <alberto.casetta at satt.biz> wrote:
> I have a data frame with three columns. The first one is filled with factors,
> the second one with numeric values and the third one is an empty vector.
> I need fill the third column with the results of the function
> tapply(secondcolumn,firstcolumn,mean) so that I have for each row of the
> third column the mean of the second column conditional to the factor element
> in the first column.
> Thank you very much for your help.
> View this message in context: http://r.789695.n4.nabble.com/filling-a-vector-with-a-tapply-function-applied-to-another-vector-tp3039271p3039271.html
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help