[R] Help w/ matrix calc

From: <eesteves_at_ualg.pt>
Date: Thu 29 Jul 2004 - 21:38:19 EST


Dear All,
Help is needed! I have a matrix with frequencies of fish larvae per length class (var. sl) and age-group (var. median.no) obtained with

>k<-table(cut(sl,(5:22)),median.no)
>k[2:5,1:5] #to ilustrate k

        4 5 6 7

(6,7]   3  1  0  0
(7,8]   3  0  1  0
(8,9]   3  4  3  5
(9,10]  3 15  7 13

from this matrix I would like to obtain the mean age per length class i.e. vector of line means. How can I do this? If, instead of the means I wanted the variances, how could I do it?
Thanks in advance,
Eduardo Esteves



R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jul 29 22:46:14 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 02:41:16 EST