Hi all, I have a problem with grouping like I have to give count of employes in each department like if in one company there is departments like Mechanical, Computer, Fitting, electronics and Chemical hear I have to retreave the number of employes in each department and as well as I have to retreave number of John's in each department is there any function is there which can solve my problem i tried with subset(); but it is retreaving one department's data only can anyone suggest what I have to do for this thanks in advance [[alternative HTML version deleted]]
A vague answer is the best you should hope for with such a vague question with no sample data: ?table ?xtabs ?"==" A search on "Frequency tables from factors" should get you to the intro to R section with that name. -- David Winsemius On Jan 28, 2009, at 10:47 AM, venkata kirankumar wrote:> Hi all, > I have a problem with grouping like I have to give count of employes > in each > department like > > if in one company there is departments like > Mechanical, Computer, Fitting, electronics and Chemical > > hear I have to retreave the number of employes in each department > and as > well as > I have to retreave number of John's in each department > > is there any function is there which can solve my problem > i tried with subset(); > but it is retreaving one department's data only > can anyone suggest what I have to do for thisIf you had offered the code that was doing this, there may have been a person who could explain how it could be modified to return a more desirable value.> > > > thanks in advance > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.
You might want to have a look at the plyr package, http://had.co.nz/plyr, which includes tools for performing this sort of grouping. Hadley On Wed, Jan 28, 2009 at 9:47 AM, venkata kirankumar <kiran4u2all at gmail.com> wrote:> Hi all, > I have a problem with grouping like I have to give count of employes in each > department like > > if in one company there is departments like > Mechanical, Computer, Fitting, electronics and Chemical > > hear I have to retreave the number of employes in each department and as > well as > I have to retreave number of John's in each department > > is there any function is there which can solve my problem > i tried with subset(); > but it is retreaving one department's data only > can anyone suggest what I have to do for this > > > thanks in advance > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >-- http://had.co.nz/