I am a newbie to R and seek help to calculate sums of selected column for each row. My simple data frame is as below.
data = data.frame(location = c(\"a\",\"b\"
Specifying the two summations explicitly:
cbind(x1=rowSums(data[,c('v1','v2','v3')]),x2=rowSums(data[,c('v4','v5','v6')])); ## x1 x2 ## [1,] 14 13 ## [2,] 66 18 ## [3,] 8 12 ## [4,] 100 24