[R] count by category

Val valkremk at gmail.com
Tue Oct 6 01:00:59 CEST 2015


Hi All,

I have a data set ( region,  city,  town and district). The data looks like
region, city, town, district
1  1  1  1
1  1  1  2
1  1  1  3
1  1  2  1
1  1  2  2
1  2  1  1

I want the  counts for   region, city and town.  Here region 1 has 6
records, city 1 has 5 records and city 2 has 1 record. Similarly, town 1
has 3 records and town 2 has 2  and so  on.
Desired out put to a file
1  1  1  1  6 5 3
1  1  1  2  6 5 3
1  1  1  3  6 5 3
1  1  2  1  6 5 2
1  1  2  2  6 5 2
1  2  3  1  6 1 1

Thank you in advance

	[[alternative HTML version deleted]]



More information about the R-help mailing list