[R] RE:

David Meyer david.meyer at ci.tuwien.ac.at
Fri Jan 25 11:24:30 CET 2002


Carlos Ortega wrote:
> 
> Hello,
> 
> Although your message is not very explicit about the structure of your data
> frame,
> I think you can get what you want by using a combination of the function
> "split" and
> the "apply" functions family: apply, lapply and sapply.
> 
> If you provide a more detailed organization of your data frame, perhaps we
> can give
> to you a more wiser advice.

aggregate() is your friend.

-d

> 
> Thanks,
> Carlos.
> P.S: By the way, please include in the "Subject" a more descriptive message.
> 
> -----Mensaje original-----
> De: owner-r-help at stat.math.ethz.ch
> [mailto:owner-r-help at stat.math.ethz.ch]En nombre de Erin Hodgess
> Enviado el: miércoles, 23 de enero de 2002 22:39
> Para: r-help at stat.math.ethz.ch
> Asunto:
> 
> Dear R People:
> 
> Here is a very simple question, please:
> 
> I have a data frame with the state name, state division, and population.
> 
> Note: state division is something like Atlantic, Mountain, etc.
> 
> I want to produce a table with the state division and the total of the
> populations for the states within that division.
> 
> I've been messing with "table" but so far, no luck.
> 
> This is R1.3.1, on Windows 98.
> 
> thanks in advance!
> 
> Sincerely,
> Erin Hodgess
> Associate Professor
> Department of Computer and Mathematical Sciences
> University of Houston - Downtown
> 1 Main Street
> Houston, TX 77002
> mailto: hodgess at uhddx01.dt.uh.edu
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-- 
	Mag. David Meyer		Wiedner Hauptstrasse 8-10
Vienna University of Technology		A-1040 Vienna/AUSTRIA
       Department for			Tel.: (+431) 58801/10772
Statistics and Probability Theory	mail: david.meyer at ci.tuwien.ac.at
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list