[R] Merging tables of differing lengths
David R. Gagnon
gagnon at bu.edu
Tue Oct 17 20:52:47 CEST 2006
Hi,
I am using the table() function on two different vectors to obtain a
frequency distribution for each:
>tabtyp1 <- table(wintype1)
>tabtyp2 <- table(wintype2)
The resulting tables look like this:
> tabtyp1 <- table(wintype1)
> tabtyp2 <- table(wintype2)
> tabtyp1
wintype1
0 2 3 4 5 6 7 8
16826 10031 1636 797 239 399 63 6
> tabtyp2
wintype2
0 2 3 4 5 6 7 8 10
16857 10012 1703 788 171 375 77 14 3
What I want to do is merge these two tables into a 2X10 table in order
to do a chi-square test. Given the unequal number of columns, all my
attempts are failing. I am also having instances where the number of
columns is the same, but the values are different, e.g., one table has
values for 7 and not 8, while the other lacks 7s but has 8s. Any
suggestions?
More information about the R-help
mailing list