[R] sort a data.frame in a different way

Sven E. Templer sven.templer at gmail.com
Wed Oct 22 20:30:41 CEST 2014


seems like a transpose, so use

?t
t(your.data.frame)


On 22 October 2014 11:34, Matthias Weber <Matthias.Weber at fntsoftware.com> wrote:
> Hello together,
>
> i have a little problem. Maybe anyone can help me.
>
> I have a data. frame which look like this one:
>      1000     1001     1002    1003
> 1    5          6         12        11
> 2    4          3          8        1
>
> What i need is a data.frame, which looks like this one. The Column names should be in the first column, and the values right of the column name. The solution look like this one:
>               A           B
> 1000      5           4
> 1001      6           3
> 1002     12          8
> 1003     11          1
>
> maybe anyone can help me.
>
> Thank you.
>
> Best regards. Mat
>
>
> ________________________________
> This e-mail may contain trade secrets, privileged, undisclosed or otherwise confidential information. If you have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal. Thank you for your cooperation.
>
> Diese E-Mail kann Betriebs- oder Geschaeftsgeheimnisse oder sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtuemlich erhalten haben, ist Ihnen eine Kenntnisnahme des Inhalts, eine Vervielfaeltigung oder Weitergabe der E-Mail ausdruecklich untersagt. Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank.
>
>         [[alternative HTML version deleted]]

please read mailing list guidelines, and don't send HTML messages

>
> ______________________________________________
> 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.



More information about the R-help mailing list