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

Ben Fairbank BEN at SSANET.COM
Fri Feb 29 18:15:33 CET 2008


as.vector(col.Sums())

Ben 

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Jason Horn
Sent: Friday, February 29, 2008 11:03 AM
To: R-help at stat.math.ethz.ch
Subject: [PS] [R] Column sums from a data frame (without the headers)

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.



More information about the R-help mailing list