[R] how to transpose a dataframe

Rolf Turner r.turner at auckland.ac.nz
Fri Jul 10 04:14:01 CEST 2009


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




More information about the R-help mailing list