# # Written by: # -- # John L. Weatherwax 2009-04-21 # # email: wax@alum.mit.edu # # Please send comments and especially bug reports to the # above email address. # #----- tmean <- function(x,p=0.2){ n = length(x) if( n==0 ) return(x) g = floor(p*n) xs = sort(x) xs = tail(xs,-g) # drop the first "g" elements xs = head(xs,-g) # drop the last "g" elements m = mean(xs) return(m) }