[R] tabulate means & NA

Christian Schulz c.schulz at metrinomics.de
Thu Jun 20 11:13:20 CEST 2002


Hi,
i have some problems to get means, but the data have got
NA's  which should not be replaced or delete !

tapply(data,var,mean)     # makes me problem,because when one value is 
NA mean is NA,too.

Another attempt is this, because the summary  does what i want , but
is not subsetable to summary[4]  if i use tapply,table  and the the 
function below gives me
again all means as NA ?

   xmean  <- function (var) {
       summary(var)[4]  }
 apply(data,2,xmean)      

Thanks for any suggestion & regards,Christian




-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list