[R] r equivalent of egen? Not tapply

From: Thomas Davidoff <davidoff_at_haas.berkeley.edu>
Date: Sat 25 Jun 2005 - 10:11:21 EST

I have a list that has about 50 elements, each repeated many times (a list of states by observation). I want to create a vector with the same length with the same value repeated over and over again within states. The value I want is the number of observations that are in the same state as each observation.
In stata, this is simply egen statesum = count(state), by(state). What is the r equivalent? tapply just gives me 50 observations. No luck yet trying apply, lapply, etc.
Thomas Davidoff
Assistant Professor
Haas School of Business
UC Berkeley
Berkeley, CA 94720

phone:     (510) 643-1425
fax:        (510) 643-7357


        [[alternative HTML version deleted]]

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 Sat Jun 25 10:16:07 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:02 EST