[R] summary.formula: method reverse does not use fun argument

Thomas Gerds gerds at fdm.uni-freiburg.de
Fri Apr 11 10:25:41 CEST 2003


hi,

recently i discovered the functionability summary.formula, awesome!
from the help page i understand that method=reverse allows to
summarize all variables on the right hand side of formula 
(the help page on line 229 wrongly refers to the left? hand side variables)
in categories which are determined by a single left hand side
variable.

my problem is that the argument fun seems not to be compatible with
method=reverse!? every continuous variable is summarized in three
quantiles.

here is an example:

hist is a factor, PET and CT are "numeric" 

summary(PET~hist,data=her,fun=sum)
PET    N=47

+-------+------------------+--+---+
|       |                  |N |PET|
+-------+------------------+--+---+
|hist   |Morbus Hodgkin    |18| 81|
|       |Niedrigmaligne NHL|11| 39|
|       |Hochmaligne NHL   |18| 49|
+-------+------------------+--+---+
|Overall|                  |47|169|
+-------+------------------+--+---+

> summary(CT~hist,data=her,fun=sum)
CT    N=47

+-------+------------------+--+---+
|       |                  |N |CT |
+-------+------------------+--+---+
|hist   |Morbus Hodgkin    |18| 70|
|       |Niedrigmaligne NHL|11| 16|
|       |Hochmaligne NHL   |18| 32|
+-------+------------------+--+---+
|Overall|                  |47|118|
+-------+------------------+--+---+

it would be desirable to combine both tables such that there is one
column for PET and one for CT ... is this possible?

trying method=reverse gives:

summary(hist~PET+CT,data=her,fun=sum,method="reverse") 

Descriptive Statistics by hist

+------+---------------+-------------------+----------------+
|      |Morbus Hodgkin |Niedrigmaligne NHL |Hochmaligne NHL |
|      |(N=18)         |(N=11)             |(N=18)          |
+------+---------------+-------------------+----------------+
|PET   |3.00/3.50/6.75 |1.50/3.00/6.00     |1.00/2.00/3.75  |
+------+---------------+-------------------+----------------+
|CT : 0|     0% (0)    |    36% (4)        |    28% (5)     |
+------+---------------+-------------------+----------------+
|    1 |    11% (2)    |     9% (1)        |    28% (5)     |
+------+---------------+-------------------+----------------+
|    2 |    28% (5)    |    36% (4)        |    11% (2)     |
+------+---------------+-------------------+----------------+
|    3 |    17% (3)    |     9% (1)        |    11% (2)     |
+------+---------------+-------------------+----------------+
|    4 |    11% (2)    |     9% (1)        |    17% (3)     |
+------+---------------+-------------------+----------------+
|    5 |     6% (1)    |     0% (0)        |     6% (1)     |
+------+---------------+-------------------+----------------+
|    6 |     6% (1)    |     0% (0)        |     0% (0)     |
+------+---------------+-------------------+----------------+
|    7 |    11% (2)    |     0% (0)        |     0% (0)     |
+------+---------------+-------------------+----------------+
|    8 |    11% (2)    |     0% (0)        |     0% (0)     |
+------+---------------+-------------------+----------------+

thanks a lot in advance,
tomy

-- 
no signature



More information about the R-help mailing list