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 <djandrija@gmail.com>wrote:

> 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 <
> mitra@informatik.uni-tuebingen.de> wrote:
>
>> 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] "Amoebozoa"                        "Amphibia"
>> "Anthozoa"                         "Aquificae (class)"
>> and so on .........
>> 98 Levels: Aconoidasida Actinobacteria (class) ....
>>
>>  and the other vector has 105 levels
>> TotalData1$Taxa.2
>>    [1] Flavobacteria                    Proteobacteria
>> Bacteroidetes/Chlorobi group     Bacteria
>>    [5] Epsilonproteobacteria            Epsilonproteobacteria
>>  Epsilonproteobacteria
>> and so on  ..........
>> 105 Levels: Acidobacteria Aconoidasida Actinobacteria (class) ....
>>
>> Now I want to create a symmetric contingency table.
>> Any quick idea will be really helpful.
>> Best regards,
>> Mitra
>>
>>        [[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<http://www.r-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>

	[[alternative HTML version deleted]]

