[R] how to include 'NA's in xtabs?
Kosenkov.Kirill at nac.spb.ru
Wed May 14 22:18:24 CEST 2003
I have a dataset with NA's in some variables (factors), for example:
$ P67 : Factor w/ 2 levels "-","+": NA 2 1 NA NA 2 1 1 2 NA ...
I need to use 'xtabs' like
It works well and produces something like this:
but i want to compute NA's too, like this:
- + NA
779 1318 137
I am trying xtabs(~x$P67, exclude=NULL) but xtabs does not compute
'NA's in this case too.
I do not want to transform my data (do not want to do any
substitution on NA's).
How i can say 'xtabs' to compute NA-values?
and second question: how to use argument 'na.action' in 'xtabs'?
'xtabs' help page does not explain this.
More information about the R-help