Re: [R] Counting frequency within each range

2012-07-26 Thread Chintanu
Thank you, all ! That's very helpful. Kind regards, Chintanu = On Fri, Jul 27, 2012 at 12:57 PM, arun wrote: > Hi, > > Try this:a<-c(4,5,23,34,43,54,56,65,67,324,435,453,456,567,657) > a1<-melt(table(cut(a,breaks=c(0,10,20,30,60,120,240,480,960 > a2<-d

Re: [R] Counting frequency within each range

2012-07-26 Thread arun
Hi, Try this:a<-c(4,5,23,34,43,54,56,65,67,324,435,453,456,567,657) a1<-melt(table(cut(a,breaks=c(0,10,20,30,60,120,240,480,960 a2<-data.frame(sapply(a1,function(x) gsub("\\(|\\]","",gsub("\\,","-",x colnames(a2)<-c("numbers","Freq") a2 #  numbers Freq #1    0-10    2 #2   10-20    0 #3  

Re: [R] Counting frequency within each range

2012-07-26 Thread David L Carlson
table(cut(numbers, c(0, 10, 20, 30, . . .), include.lowest=TRUE)) -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-hel

Re: [R] Counting frequency within each range

2012-07-26 Thread R. Michael Weylandt
Combine cut() and table() Michael On Jul 26, 2012, at 8:22 PM, Chintanu wrote: > Hi, > > This is a simple problem, but for the life of me I cannot find the answer. > How to determine frequency within given ranges ? > I know that table() gives frequency, for example > > a <- table(numbers) >>