[R] quantiles on rows of a matrix

2010-07-07 Thread Jim Bouldin
I'm trying to obtain the mean of the middle 95% of the values from each row of a matrix (that is, the highest and lowest 2.5% of values in each row are removed before calculating the mean). I am having all sorts of problems with this; for example the command: apply(matrix1,1,function(x)

Re: [R] quantiles on rows of a matrix

2010-07-07 Thread Bill.Venables
apply(matrix1, 1, quantile, probs = c(0.05, 0.9), na.rm = TRUE) may be what you are looking for. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jim Bouldin Sent: Thursday, 8 July 2010 8:52 AM To: R help Subject: [R] quantiles

Re: [R] quantiles on rows of a matrix

2010-07-07 Thread David Winsemius
On Jul 7, 2010, at 6:52 PM, Jim Bouldin wrote: I'm trying to obtain the mean of the middle 95% of the values from each row of a matrix (that is, the highest and lowest 2.5% of values in each row are removed before calculating the mean). A winsorized.mean? I am having all sorts of

Re: [R] quantiles on rows of a matrix

2010-07-07 Thread Peter Ehlers
On 2010-07-07 16:52, Jim Bouldin wrote: I'm trying to obtain the mean of the middle 95% of the values from each row of a matrix (that is, the highest and lowest 2.5% of values in each row are removed before calculating the mean). I am having all sorts of problems with this; for example the