Hi Val, You can even get a graphic illustration of this quite easily: library(plotrix) sizetree(dataset)
Jim On Tue, Oct 6, 2015 at 10:00 AM, Val <valkr...@gmail.com> wrote: > 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]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.