aggregate(data$third, by=list(data$first), sum)
or reqiure(reshape) cast(melt(data), ~first, sum) On Jun 28, 2010, at 9:30 PM, Yi wrote:
first=c('u','b','e','k','j','c','u','f','c','e') second = c ('usa ','Brazil ','England','Korea','Japan','China','usa','France','China','England') third=1:10 data=data.frame(first,second,third)
______________________________________________ R-help@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.