[R] Transform contingency table into data.frame ?

Ivan Calandra ivan.calandra at uni-hamburg.de
Wed Mar 17 10:53:43 CET 2010


Hi,

I don't really understand what the problem is... There is no duplicated 
column... Maybe you mean the row names? If it is so, then just don't use 
row names.

Ivan

Le 3/17/2010 10:45, Carlos Petti a écrit :
> Dear list,
>
> I have a contingency table :
>
> a<- letters[1:3]
> t<- table(a)
>
> I'm looking for a way to transform this table into data frame, as follows :
>
>   Freq
> a    1
> b    1
> c    1
>
> I used :
>
> df<- as.data.frame(t, row.names = names(t))
>
> But, this function do not remove the duplicated column. Do you know the
> solution ?
>
> Thanks in advance,
> Carlos
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>
>    

-- 
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calandra at uni-hamburg.de

**********
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php



More information about the R-help mailing list