I don't know Stata, and I don't know if I understand your question. Consider the following:
> (AList <- as.list(rep(letters[1:3], 2)) + ) [[1]] [1] "a" [[2]] [1] "b" [[3]] [1] "c" [[4]] [1] "a" [[5]] [1] "b" [[6]] [1] "c" > (unlist(AList)) [1] "a" "b" "c" "a" "b" "c" > table(unlist(AList)) a b c 2 2 2 Does this answer your question? If not, PLEASE do read the posting guide! "http://www.R-project.org/posting-guide.html". The discipline of following that guide might lead you to an answer. If it doesn't, it will likely increase the chances of getting a useful reply. spencer graves Thomas Davidoff wrote: > 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 > [EMAIL PROTECTED] > http://faculty.haas.berkeley.edu/davidoff > > > [[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 -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com <http://www.pdf.com> Tel: 408-938-4420 Fax: 408-280-7915 ______________________________________________ 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