Questions regarding rowsum, R function which gives column sums of a matrix or data frame, based on a grouping variable