Skip to content

Data reshaping

2 messages · Christofer Bogaso, Duncan Mackay

#
library(reshape2)

dcast(Dat, X1 ~X2, value.var = "X3")
   X1  1  2  3  4
1  A 11 12 13 14
2  B 15 16 17 18
3  C 19 20 21 NA

or  use ? reshape

HTH

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mackay at northnet.com.au
At 10:37 28/05/2013, you wrote: