[R] summing columns using partial labels

From: T Petersen <Innkeyp-r_at_yahoo.com>
Date: Wed 06 Apr 2005 - 04:05:36 EST


I have a dataset of the form

Year tosk.fai tosk.isd tosk.gr ....... tosk.total hysa.fai hysa.isd ...

and so on. I want to sum all the columns using the first four letters in the columns label(e.g. 'tosk', 'hysa' etc.). How can you do that? Also, the sums should be without the '.total'column (e.g. 'tosk.total') as this serves as a check that everything was done right.

Kind regards



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Apr 06 04:12:28 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:01 EST