Dear list,

Thank you for your answers.

Petr, your solution works great :-)

Peter's solution too.

Carlos

2010/3/17 Ivan Calandra <ivan.calan...@uni-hamburg.de>

> Now I get it, I was still thinking you wanted two columns. I was confused
> by the "print" example.
> Petr's suggestion works well then
> Ivan
>
> Le 3/17/2010 11:27, Petr PIKAL a écrit :
>
>  Hi
>>
>> and did you try my suggestion?
>>
>> as.data.frame(as.matrix(t, row.names = names(t)))
>>
>> Regards
>> Petr
>>
>> r-help-boun...@r-project.org napsal dne 17.03.2010 11:16:43:
>>
>>
>>
>>> Dear list,
>>>
>>> Sorry, I did not explain myself very well.
>>>
>>> I want to obtain a data.frame like this :
>>>
>>> Freq
>>> a    1
>>> b    1
>>> c    1
>>>
>>> This data.frame contains just one column (Freq) and each row is named.
>>>
>>> But when I use this code :
>>>
>>> df<- as.data.frame(t)
>>>
>>> or this code :
>>>
>>> df<- as.data.frame(t, row.names(t))
>>>
>>> The "a" column remains.
>>>
>>> Thanks,
>>> Carlos
>>>
>>> 2010/3/17 Petr PIKAL<petr.pi...@precheza.cz>
>>>
>>>
>>>
>>>> Hi
>>>>
>>>> r-help-boun...@r-project.org napsal dne 17.03.2010 10:45:48:
>>>>
>>>>
>>>>
>>>>> 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 ?
>>>>>
>>>>>
>>>> You probably do not distinct between columns of data frame and row
>>>>
>>>>
>>> names
>>
>>
>>> of data frame. From what you told us it is not clear which one you
>>>>
>>>>
>>> want to
>>
>>
>>> keep
>>>>
>>>> if row names use
>>>>
>>>> as.data.frame(as.matrix(t, row.names = names(t)))
>>>>
>>>> if you want to keep column
>>>>
>>>> as.data.frame(t)
>>>>
>>>> shall suffice.
>>>>
>>>> Row names is not a data frame column.
>>>>
>>>> Regards
>>>> Petr
>>>>
>>>>
>>>>
>>>>
>>>>> Thanks in advance,
>>>>> Carlos
>>>>>
>>>>>    [[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
>>>>
>>>>
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>    [[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
>>
>>
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>>
>> ______________________________________________
>> 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
>> 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.calan...@uni-hamburg.de
>
> **********
> http://www.for771.uni-bonn.de
> http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php
>
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.
>

        [[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
and provide commented, minimal, self-contained, reproducible code.

Reply via email to