[R] reshaping data

Stephan Kolassa Stephan.Kolassa at gmx.de
Wed Mar 31 20:31:02 CEST 2010


Hi Kim,

look at the reshape() command with direction="wide". Or at the reshape 
package.

HTH,
Stephan


Kim Jung Hwa schrieb:
> Hi All,
> 
> Can someone help me reshape following data:
> 
> Var1 Var2 Val
> A X 1
> A Y 2
> A Z 3
> B X 4
> B Y 5
> B Z 6
> 
> to some kind of matrix/tabular format (preferably as a matrix), may be like
> 
> Var1 X Y Z
> A 1 2 3
> B 4 5 6
> 
> Any help would be greatly appreciated,
> Kim
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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