Hello,

I know there must be a simple soluton to this problem but it eludes me
currently.

My data is partitioned into two subsets, each subset has a common column
factor but with varying levels:

levels(fdf_ghc$AgeDemo)
[1] "26TO35" "36TO45" "46TO55" "56TO65" "66TO75" "76TO85"
levels(fdf_ghcnull$AgeDemo)
[1] "26TO35"  "36TO45"  "46TO55"  "56TO65"  "66TO75"  "76TO85"  "86TO100"
table(fdf_ghc$AgeDemo)
26TO35 36TO45 46TO55 56TO65 66TO75 76TO85
     6     14     21     31     19     14
table(fdf_ghcnull$AgeDemo)
 26TO35  36TO45  46TO55  56TO65  66TO75  76TO85 86TO100
      5       5      10       7       8       4       1
I need to construct a common contingency table from the two lists, but rbind
recycles values due to the differing levels:

rbind(table(fdf_ghc$AgeDemo), table(fdf_ghcnull$AgeDemo))
     26TO35 36TO45 46TO55 56TO65 66TO75 76TO85 86TO100
[1,]      6     14     21     31     19     14       6
[2,]      5      5     10      7      8      4       1
Warning message:
In rbind(table(fdf_ghc$AgeDemo), table(fdf_ghcnull$AgeDemo)) :
  number of columns of result is not a multiple of vector length (arg 1)

I need something I can pass to fisher.test() or chisq.test().

Anybody have any hints?

Thanks,
Ben

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to