aggregate(DF[,-1], DF[, 1, drop = FALSE], mean) On 4/15/06, Srinivas Iyyer <[EMAIL PROTECTED]> wrote: > dear group, > > i have a sample matrix > name v1 v2 v3 v4 > cat 10 11 12 15 > dog 3 12 10 14 > cat 9 12 12 15 > cat 5 12 10 11 > dog 12 113 123 31 > ... > > > since cat is repeated 3 times, I want a mean value for > it. Like wise for every element of the name column. > cat v1 = mean(c(10,9,5)) > cat v3 = mean(c(11,12,13)) > ..etc. > > name v1 v2 v3 v4 > cat 8 11.6 11.3 13.6 > dog 7.5 62.5 66.5 22.5 > > could any one help me in solving this mystery. thank you. > > ______________________________________________ > [email protected] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >
______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
