[R] Column sums from a data frame (without the headers)

From: Jason Horn <jason.w.horn_at_gmail.com>
Date: Fri, 29 Feb 2008 12:02:46 -0500


Does anyone know how to get a vector of column sum from a data frame? You can use colSums(), but this gives you a object of type "numeric" with the column labels in the first row, and the sums in the second row. I just want a vector of the sums, and I can't figure out a way to index the "numeric" object.

Thanks!



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 29 Feb 2008 - 17:08:39 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 29 Feb 2008 - 17:30:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive