Dear kayj, Here is one way:
# Data set.seed(123) x=runif(100) # Cuts as.data.frame.table(table(cut(x,seq(0,1,by=0.1)))) #Var1 Freq #1 (0,0.1] 7 #2 (0.1,0.2] 12 #3 (0.2,0.3] 11 #4 (0.3,0.4] 9 #5 (0.4,0.5] 14 #6 (0.5,0.6] 7 #7 (0.6,0.7] 11 #8 (0.7,0.8] 11 #9 (0.8,0.9] 11 #10 (0.9,1] 7 See ?cut, ?table and ?as.data.frame.table for more information. HTH, Jorge On Tue, Nov 18, 2008 at 12:50 AM, kayj <[EMAIL PROTECTED]> wrote: > > Hi All, > > I have a column that contains values between 0 and 1. I would like to make > a table that consists of the number of elements in each category. > > For example , how many elements have values between 0 and 0.1, 0.1 to 0.2, > 0.2 to 0.3,etc ..0.9 to 1. > > Is there an easy way to do this? > > Thanks > > -- > View this message in context: > http://www.nabble.com/counting-the-number-of-elements-in-a-column-tp20553994p20553994.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@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. > [[alternative HTML version deleted]]
______________________________________________ R-help@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.