Re: [R] frequency table

2006-09-21 Thread Robert Baer
Robert W. Baer, Ph.D. Associate Professor Department of Physiology A. T. Still University of Health Science 800 W. Jefferson St. Kirksville, MO 63501-1497 USA - Original Message - > > > z = rep(c("M","F"),c(50,60)) >How can I get the following frequency t

Re: [R] frequency table

2006-09-21 Thread David Barron
You might want to look at the CrossTable function in the gmodels package (in the gregmisc bundle). On 21/09/06, lamack lamack <[EMAIL PROTECTED]> wrote: > Dear all, I have a vector like this: > > z = rep(c("M","F"),c(50,60)) > > How can I get the following frequency table: > > Sex coun

Re: [R] frequency table

2006-09-21 Thread David Barron
And look at ?prop.table too. On 21/09/06, lamack lamack <[EMAIL PROTECTED]> wrote: > Dear all, I have a vector like this: > > z = rep(c("M","F"),c(50,60)) > > How can I get the following frequency table: > > Sex counts % > F60 54.5 > M 50

Re: [R] Frequency table

2004-03-18 Thread joseclaudio.faria
Hi, See if this generic function I made can help you. data <- c(65, 70, 85, 65, 65, 65, 62, 55, 82, 59, 55, 66, 74, 55, 65, 56, 80, 73, 45, 64, 75, 58, 60, 56, 60, 65, 53, 63, 72, 80, 90, 95, 55, 70, 79, 62, 57, 65, 60, 47, 61, 53, 80, 7

Re: [R] Frequency table

2004-03-17 Thread Peter Dalgaard
Prof Brian Ripley <[EMAIL PROTECTED]> writes: > > tt<-table(zz%/%10) > > n <- names(tt) > > names(tt) <- paste(n,0,"-",n,9,sep="") > > tt > > data.frame(count=c(tt)) > > > > Beware that empty groups are silently zapped, though. > > FWIW, table(factor(zz%/%10, levels=0:9)) avoids that I knew, b

RE: [R] Frequency table

2004-03-17 Thread Gabor Grothendieck
Assuming x contains the data, taking the solutions so far and adding some minor improvements gives: groups <- x %/% 10 lev <- min(groups):max(groups) lab <- factor( paste( lev, "0-", lev, "9", sep = "" ) ) groups <- factor( groups, lev = lev, lab = lab ) tab <- table( groups,

Re: [R] Frequency table

2004-03-17 Thread Prof Brian Ripley
On 17 Mar 2004, Peter Dalgaard wrote: > Kai Hendry <[EMAIL PROTECTED]> writes: > > > > 40-49 2 > > 50-59 15 > > 60-69 20 > > 70-79 19 > > 80-89 12 > > 90-99 2 > > Here's another solution for this 10-year age group thing: > > tt<-table(zz%/%10) > n <- names(tt) > names(tt) <- paste(

Re: [R] Frequency table

2004-03-17 Thread Peter Dalgaard
Kai Hendry <[EMAIL PROTECTED]> writes: > 40-49 2 > 50-59 15 > 60-69 20 > 70-79 19 > 80-89 12 > 90-99 2 Here's another solution for this 10-year age group thing: tt<-table(zz%/%10) n <- names(tt) names(tt) <- paste(n,0,"-",n,9,sep="") tt data.frame(count=c(tt)) Beware that empty gro

Re: [R] Frequency table

2004-03-17 Thread Philipp Pagel
On Wed, Mar 17, 2004 at 04:55:19PM +0200, Kai Hendry wrote: > I am trying to construct a frequency table. I guess this should be done with > table. Or perhaps factor and split. Or prop.table. cut? findInterval? Argh! > I got this far: > > table(cut(zz$x9, brk)) > > (40,50] (50,60] (60,70] (7

Re: [R] Frequency table

2004-03-17 Thread Marc Schwartz
On Wed, 2004-03-17 at 08:55, Kai Hendry wrote: > This must be FAQ, but I can't find it in archives or with a site search. > > I am trying to construct a frequency table. I guess this should be done with > table. Or perhaps factor and split. Or prop.table. cut? findInterval? Argh! > > Please corre

Re: [R] Frequency table

2004-03-17 Thread Peter Dalgaard
Kai Hendry <[EMAIL PROTECTED]> writes: > This must be FAQ, but I can't find it in archives or with a site search. > > I am trying to construct a frequency table. I guess this should be done with > table. Or perhaps factor and split. Or prop.table. cut? findInterval? Argh! > > Please correct me i

Re: [R] Frequency table

2004-03-17 Thread Uwe Ligges
Kai Hendry wrote: This must be FAQ, but I can't find it in archives or with a site search. I am trying to construct a frequency table. I guess this should be done with table. Or perhaps factor and split. Or prop.table. cut? findInterval? Argh! Please correct me if what I am looking for is not cal

RE: [R] Frequency table

2004-03-17 Thread Adaikalavan Ramasamy
?data.frame data.frame( table(cut(x, seq(0, 1, by=0.1))) ) > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Kai Hendry > Sent: 17 March 2004 14:55 > To: [EMAIL PROTECTED] > Subject: [R] Frequency table > > > This must be FAQ, but I can't find it in ar

RE: [R] Frequency table

2004-03-17 Thread Liaw, Andy
I guess you want something like: table(cut(zz$x9, c(-Inf, seq(40, 90, by=10), Inf))) HTH, Andy > From: Kai Hendry > > This must be FAQ, but I can't find it in archives or with a > site search. > > I am trying to construct a frequency table. I guess this > should be done with > table. Or perh

RE: [R] frequency table

2003-06-24 Thread Bill . Venables
OTECTED] Sent: Wednesday, June 25, 2003 2:13 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [R] frequency table Professor Baron writes: > > A neat trick with table() is that you can use it to tabulate > columns of a matrix (for example) with: >

Re: [R] frequency table

2003-06-24 Thread Robin Hankin
Professor Baron writes: > > A neat trick with table() is that you can use it to tabulate > columns of a matrix (for example) with: > > apply(mymatrix,2,table) > OK, I'll bite: > x1 <- matrix(1:3,7,4,byrow=T) Warning message: Replacement length not a multiple of the elements to replace in mat