On 22/11/2009 3:44 PM, ychu066 wrote: > for example, i want to sum all the row entries if column 1 takes the value > "boy". anyone knows ? Subset then sum: sum(M[M[,1] == "boy", ]) Duncan Murdoch