Hi,
I have the following matrix cc <- matrix (1:21, 3) cc[,3:4]<- 0 cc [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 1 4 0 0 13 16 19 [2,] 2 5 0 0 14 17 20 [3,] 3 6 0 0 15 18 21 and I would like to sum just the values in columns 2, 3 and 4, so to have something like 1 4 13 16 19 2 5 14 17 20 3 6 15 18 21 Thanks Lorenzo [[alternative HTML version deleted]] ______________________________________________ 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.