Hi,

x<-matrix(0,80,ncol=1)

will create x matrix with all elements 0 (to be filled by the sums that you
need)

sum(y[y[,4]==1,5]) 

will calculate the sum of 5th column of y with 4th column=1

Similarly, 

sum(y[y[,4]==80,5])

 will calculate the sum of 5th column of y with 4th column=80.

You can adapt this to your case, with simple loops, etc.

Hope this helps.
Ozgur

--
View this message in context: 
http://r.789695.n4.nabble.com/Summarizing-a-matrix-tp4632319p4632381.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to