[R] Merging tables of differing lengths

From: David R. Gagnon <gagnon_at_bu.edu>
Date: Tue 17 Oct 2006 - 18:52:47 GMT

   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?

R-help@stat.math.ethz.ch 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. Received on Wed Oct 18 05:40:11 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 17 Oct 2006 - 21:30:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.