use 'dput' to enclose your data. I think 'cut' is what you want: > dput(x) c(0, 1.179, 3.729, 9.418, 18.01, 29.746, 58.662, 131.566, 2323.7 ) > dput(y) c(5.79, 1579.52, 2323.7, 68.85, 426.07, 110.29, 108.29, 1067.6, 17.05, 22.66, 21.02, 175.88, 139.07, 144.12, 20.46, 43.4, 194.9, 47.3, 7.74, 0.4, 82.85, 9.88, 89.29, 215.1, 1.75, 0.79, 15.93, 3.91, 0.27, 0.69, 100.58, 27.8, 13.95, 53.24, 0.96, 4.15, 0.19, 0.78, 8.01, 31.75, 7.35, 6.5, 8.27, 33.91, 32.52, 3.16, 4.85, 2.78, 4.67, 1.31, 12.06, 36.71, 72.89, 1.97, 0.59, 2.58, 1.69, 2.71, 25.5, 0.35, 0.99, 3.99, 3.67, 2.07, 0.96, 5.35, 2.9, 13.77, 0.47, 0.73, 1.4, 0.74, 0.39, 1.13, 0.09, 2.38) > z <- cut(y, x) > table(z) z (0,1.18] (1.18,3.73] (3.73,9.42] (9.42,18] (18,29.7] 17 13 12 6 5 (29.7,58.7] (58.7,132] (132,2.32e+03] 7 7 9
On Sat, Aug 11, 2012 at 9:59 AM, hafida <hafida...@hotmail.fr> wrote: > Hi > > > >i have this data > > > X > [1] 5.79 1579.52 2323.70 68.85 426.07 110.29 108.29 1067.60 > 17.05 > 22.66 > [11] 21.02 175.88 139.07 144.12 20.46 43.40 194.90 47.30 > 7.74 > 0.40 > [21] 82.85 9.88 89.29 215.10 1.75 0.79 15.93 3.91 > 0.27 > 0.69 > [31] 100.58 27.80 13.95 53.24 0.96 4.15 0.19 0.78 > 8.01 > 31.75 > [41] 7.35 6.50 8.27 33.91 32.52 3.16 4.85 2.78 > 4.67 > 1.31 > [51] 12.06 36.71 72.89 1.97 0.59 2.58 1.69 2.71 > 25.50 > 0.35 > [61] 0.99 3.99 3.67 2.07 0.96 5.35 2.90 13.77 > 0.47 > 0.73 > [71] 1.40 0.74 0.39 1.13 0.09 2.38 > > >and i have an intervale I[j]<- leftaj, rightaj HERE I > CAN > T PROGRAMATE THIS INTERVAL > > >SO i have > > >> leftaj > [1] 0 1.179 3.729 9.418 18.010 29.746 58.662 131.566 > > rightaj > [1] 1.179 3.729 9.418 18.010 29.746 58.662 131.566 2323.700 > > > >i want to counting the number of X hows in the intervale [leftaj, > rightaj] > > >thanks for helping > >hafida > > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/help-counting-in-data-tp4640033.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. > -- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. [[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.