[R] Particular Cross tables
Kenneth Cabrera
krcabrer at epm.net.co
Sun May 19 06:26:10 CEST 2002
Dear R experts:
I have this data base (data frame) with three variables
where f1 and f2 are factors.
I want to obtain a table with the sum of the third variable
at each cross element of the two factors.
Would you help me with any function idea?
Original data base (data frame)
f1 f2 v1
1 2 10
1 1 20
1 2 30
1 3 40
2 1 50
2 2 60
1 1 70
3 1 80
3 2 90
2 2 10
I would like to obtain this matrix (sum of the crossed elements with
zeros where I don't have any crossed factor)
Factor 1
90 40 40
Factor 2 50 70 0
80 90 0
Is it possible to obtain any kind of function (not only sum())?
(like sd(), for example?)
Thank you very much for your help.
Kenneth
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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