[R] NA's in multiple choice summary table in Hmisc
Erich Studerus, Psychiatrische Uni-Klinik
erich.studerus at bli.uzh.ch
Thu Oct 9 00:49:20 CEST 2008
Hi,
I have a set of 30 binary variables measuring side effects after drug
treatment. Since each subject can have multiple side effects, I want to
display these side effects in a multiple choice table. I'm using the summary
and mChoice functions of the Hmisc package, because it produces nicely
formatted latex tables. My problem is, that table includes a category for
people who have at least one absent symptom and I don't know how to exclude
it.
Here's a very easy reproducible example:
library(Hmisc)
Symptom1<-c("Headache","Headache",NA)
Symptom2<-c(NA,"Anxiety",NA)
Symptoms<-mChoice(Symptom1,Symptom2)
summary(~Symptoms,method="reverse")
Descriptive Statistics (N=3)
+-------------------+-------+
| | |
+-------------------+-------+
|Symptom1 : Headache|67% (2)|
+-------------------+-------+
| NA |67% (2)|
+-------------------+-------+
| Anxiety |33% (1)|
+-------------------+-------+
Now, I want to either completely exclude the NA category or - if included -
it should count the number of people who have NA's in all symptoms rather
than in a single symptom. In the example above, the NA's should be 1 instead
of 2 cases.
I tried to specify na.include=FALSE but it does not work.
Any help is highly appreciated.
Erich
More information about the R-help
mailing list