[R] removing lower and upper quantiles from an arry

Peter Ehlers ehlers at ucalgary.ca
Thu Feb 17 11:43:27 CET 2011


Here's one more way:

  i[ findInterval(i, quantile(i, c(.25, .75))) == 1 ]


Peter Ehlers

On 2011-02-17 02:08, 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.



More information about the R-help mailing list