« Return to Thread: how to transpose a dataframe

Re: how to transpose a dataframe

by Rolf Turner-3 :: Rate this Message:

Reply to Author | View in Thread


On 10/07/2009, at 1:31 PM, roachyang wrote:

>
> 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?

(a) ***Anything*** can be done in R; if there isn't a function to do it,
you can write one.

(b) ``Transpose'' is ***NOT*** the right word.  You probably mean  
``transform''.

(c) See ?reshape.

        cheers,

                Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

______________________________________________
R-help@... 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.

 « Return to Thread: how to transpose a dataframe