[R] Creating a symmetric contingency table from two vectors with different length of levels in R

2011-04-06 Thread suparna mitra
Hello, How can I create a symmetric contingency table from two categorical vectors having different length of levels? For example one vector has 98 levels TotalData1$Taxa.1 [1] Aconoidasida Actinobacteria (class) Actinopterygii Alphaproteobacteria [5]

Re: [R] Creating a symmetric contingency table from two vectors with different length of levels in R

2011-04-06 Thread andrija djurovic
Hi: Here is one solution: a-factor(c(1,2,4,5,6)) b-factor(c(2,2,4,5,5)) b1-factor(b,levels=c(levels(b),levels(a)[levels(a)%in%levels(b)==FALSE])) table(a,b1) but be aware that levels of b is a subset of levels of a. Andrija On Wed, Apr 6, 2011 at 10:39 AM, suparna mitra

Re: [R] Creating a symmetric contingency table from two vectors with different length of levels in R

2011-04-06 Thread suparna mitra
Dear Andrija, Thank you very much for your quick reply. It looks like working. Thanks again, Suparna. On Wed, Apr 6, 2011 at 2:11 PM, andrija djurovic djandr...@gmail.comwrote: Hi: Here is one solution: a-factor(c(1,2,4,5,6)) b-factor(c(2,2,4,5,5))