[R] how to transpose a dataframe

roachyang roachyang at gmail.com
Fri Jul 10 05:21:26 CEST 2009


Seems like this is the one. But I got this message
"reached getOption("max.print") -- omitted 12259 rows", 
and there are some data missing. What happened?


Bill.Venables wrote:
> 
> Look at the 'reshape' package, with functions melt() and cast()
> 
> (I'm not sure how the remark about the virtues of SAS is relevant, but if
> you really want SAS, I presume you know where to find it.)
> ________________________________________
> From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] On
> Behalf Of roachyang [roachyang at gmail.com]
> Sent: 10 July 2009 11:31
> To: r-help at r-project.org
> Subject: [R]  how to transpose a dataframe
> 
> I want to transpose a dataframe like
>       level   2006   2007   2008
>         A       ....
>         B      .....
>         C        ........
> into
>       level    year
>         A      2006
>         A      2007
>         A      2008
>         B      2006
>         B      2007
>            ......
> There is a procedure in SAS can do this, is there any function in R can do
> this?
> 
> --
> View this message in context:
> http://www.nabble.com/how-to-transpose-a-dataframe-tp24420450p24420450.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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.
> 
> ______________________________________________
> 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.
> 
> 

-- 
View this message in context: http://www.nabble.com/how-to-transpose-a-dataframe-tp24420450p24421173.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list