[R] Count between interval
Eik Vettorazzi
E.Vettorazzi at uke.uni-hamburg.de
Mon Feb 22 16:35:02 CET 2010
Hi,
ab<-read.table(header=F,file=textConnection("-1.3
1
-1.5
-1
1.5
-2.5
3
-0.5"))
length(which(ab >=-2 & ab<=2))
Bosken schrieb:
> Hi all,
>
> I take a simple dataset like this:
>
> -1.3
> 1
> -1.5
> -1
> 1.5
> -2.5
> 3
> -0.5
>
> Now I want to count how many values there are between -2 and 2.
>
> The answer here would be 6.
>
> Can anyone do this with R?
>
> Thank you in advance.
>
> Gr. Bosken
>
--
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf
Martinistr. 52
20246 Hamburg
T ++49/40/7410-58243
F ++49/40/7410-57790
More information about the R-help
mailing list