Re: [R] Using table to get frequencies of several factors at once

2013-01-17 Thread Greg Snow
The tables package may be of use to you for this. On Fri, Jan 11, 2013 at 4:17 AM, Pancho Mulongeni < p.mulong...@namibia.pharmaccess.org> wrote: > Hi, I have a dataframe with n columns, but I am only looking at five of > them. And lots of rows, over 700. > So I would like to find frequencies fo

Re: [R] Using table to get frequencies of several factors at once

2013-01-16 Thread S Ellison
You could use a variant of apply(), probably sapply For example d <- as.data.frame( matrix(sample(0:1, 200, replace=TRUE), ncol=5)) head(d) sapply(d, table) S Ellison > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Pancho M

Re: [R] Using table to get frequencies of several factors at once

2013-01-14 Thread Pancho Mulongeni
Yes thank you, that worked. -Original Message- From: John Kane [mailto:jrkrid...@inbox.com] Sent: Friday, January 11, 2013 4:23 PM To: Pancho Mulongeni; R help Subject: RE: [R] Using table to get frequencies of several factors at once Does something like this do what you want? It

Re: [R] Using table to get frequencies of several factors at once

2013-01-11 Thread John Kane
Does something like this do what you want? It returns a list of tables md <- data.frame((matrix(sample(1:5, 100, replace = TRUE),nrow= 10))) str(md) apply(md, 2, table) John Kane Kingston ON Canada > -Original Message- > From: p.mulong...@namibia.pharmaccess.org > Sent: Fri, 11 J