[R] Re : Adding column sum to new row in data frame

Wu Gong ghowoo at gmail.com
Thu May 20 04:46:14 CEST 2010

To remove NA instead of Total:

rbind(data,cbind(State="Total", t(apply(data[,-1],2,sum))))

A R learner.
View this message in context: http://r.789695.n4.nabble.com/Re-Adding-column-sum-to-new-row-in-data-frame-tp2223277p2223855.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list