Thanks to all for help. The filter function appears most straightforward way for this problem. Kevin -- View this message in context: http://r.789695.n4.nabble.com/R-beginner-matrix-algebra-tp4653335p4653414.html Sent from the R help mailing list archive at Nabble.com.