[R] tapply using 2 factors

José Ernesto Jardim ernesto at ipimar.pt
Tue Apr 17 13:36:12 CEST 2001


I'm trying to use tapply with two factors and the results are not what I
expected. Using one factor at a time it works well but when combining
the two factors the results are:

> tapply(mat[,1],list(mat[,3],mat[,6]),FUN=rep.boot)

  1            2            3            4            5            6
9 "Numeric,12" "Numeric,13" "Numeric,13" "Numeric,14" "Numeric,15"
C "Numeric,31" "Numeric,38" "Numeric,37" "Numeric,36" "Numeric,31"
  7            8            9            10           11           12
9 "Numeric,15" "Numeric,15" "Numeric,13" "Numeric,12" "Numeric,12"
C "Numeric,30" "Numeric,36" "Numeric,31" "Numeric,36" "Numeric,33"

Can you please tell me what I'm doing wrong ?



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