HI,
Not sure whether this is what you wanted. dat3<-c(5.79, 1579.52, 2323.70, 68.85, 426.07, 110.29, 108.29, 1067.60, 17.05, 22.66, 21.02, 175.88, 139.07, 144.12, 20.46, 43.40, 194.90, 47.30, 7.74, 0.40, 82.85, 9.88, 89.29, 215.10, 1.75, 0.79, 15.93, 3.91, 0.27, 0.69, 100.58, 27.80, 13.95, 53.24, 0.96, 4.15, 0.19, 0.78, 8.01, 31.75, 7.35, 6.50, 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.50, 0.35, 0.99, 3.99, 3.67, 2.07, 0.96, 5.35, 2.90, 13.77, 0.47, 0.73, 1.40, 0.74, 0.39, 1.13, 0.09, 2.38) leftaj<-c( 0, 1.179,3.729,9.418, 18.010, 29.746, 58.662, 131.566) rightaj<-c(1.179, 3.729, 9.418, 18.010, 29.746, 58.662, 131.566, 2323.700) leftajmax<-max(leftaj) rightajmax<-max(rightaj) leftajmin<-min(leftaj) rightajmin<-min(rightaj) dat3[(dat3<rightajmax & dat3>leftajmax)|(dat3>leftajmin & dat3<rightajmin)] #[1] 1579.52 426.07 1067.60 175.88 139.07 144.12 194.90 0.40 215.10 #[10] 0.79 0.27 0.69 0.96 0.19 0.78 0.59 0.35 0.99 #[19] 0.96 0.47 0.73 0.74 0.39 1.13 0.09 length(dat3[(dat3<rightajmax & dat3>leftajmax)|(dat3>leftajmin & dat3<rightajmin)]) #[1] 25 A.K. ----- Original Message ----- From: hafida <hafida...@hotmail.fr> To: r-help@r-project.org Cc: Sent: Saturday, August 11, 2012 9:59 AM Subject: [R] help counting in data 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. ______________________________________________ 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.