[R] trimmed mean

darteta001 at ikasle.ehu.es darteta001 at ikasle.ehu.es
Fri Oct 5 13:24:06 CEST 2007


Dear list,

I would like to calculate the trimmed mean for some subsets within a 
data.frame (data). The list has already been very helpful, and I have 
managed calculating the standard mean for the "Intensity" column based 
on the "Name" column using

> avgs <-aggregate(data$Intensity, by = list(data$Name), mean)


but I cannot include the argument trim to mean()

> avgs <-aggregate(data$Intensidad, by = list(data$Name), mean
(trim=0.1))
Error in mean.default(trim = 0.1) : argument "x" is missing, with no 
default
> avgs <-aggregate(data$Intensity, by = list(data$Name), mean
(data$Intensity, trim=0.1))
Error in FUN(X[[1]], ...) : argument "INDEX" is missing, with no 
default

What is the "INDEX" argument I am missing?

Thanks in advance,

David



More information about the R-help mailing list