[R] removing lower and upper quantiles from an arry

Dimitris Rizopoulos d.rizopoulos at erasmusmc.nl
Thu Feb 17 11:20:57 CET 2011


have a look at the help page for ?'&', try also this:

i <- 1:20
qs <- quantile(i, c(.25, 0.75))
i[i > qs[1] & i < qs[2]]


I hope it helps.

Best,
Dimitris


On 2/17/2011 11:08 AM, Maas James Dr (MED) wrote:
> I'm trying to work out the simplest way to remove the upper and lower quantiles, in this case upper and lower 25% from an array.  I can do it in two steps but when I try it in one, it fails.  Is there something simple missing from my syntax or are there other simple elegant way to accomplish this?
>
> Thanks
>
> J
>
>> i<-1:20
>> i2<- i[i<quantile(i,.75)]
>> i3<- i[i>quantile(i,.25)]
>> i4<- i[quantile(i,.25)<  i>  quantile(i,.75)]
> Error: unexpected '>' in "i4<- i[quantile(i,.25)<  i>"
>
> ===============================
> Dr. Jim Maas
> University of East Anglia
>
> ______________________________________________
> R-help at 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.
>

-- 
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus University Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014
Web: http://www.erasmusmc.nl/biostatistiek/



More information about the R-help mailing list