[R] removing lower and upper quantiles from an arry

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Thu Feb 17 11:18:43 CET 2011


You need two logical test and then combine them with & (AND) or | (OR)

i[quantile(i,.25) >= i & i <= quantile(i,.75)]

Best regards,

Thierry

----------------------------------------------------------------------------
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium

Research Institute for Nature and Forest
team Biometrics & Quality Assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium

tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
  

> -----Oorspronkelijk bericht-----
> Van: r-help-bounces op r-project.org 
> [mailto:r-help-bounces op r-project.org] Namens Maas James Dr (MED)
> Verzonden: donderdag 17 februari 2011 11:09
> Aan: r-help op r-project.org
> Onderwerp: [R] removing lower and upper quantiles from an arry
> 
> 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 op 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