[R] Trouble reshaping some data
Andrew C. Ward
s195404 at student.uq.edu.au
Thu Oct 30 05:27:34 CET 2003
I would appreciate some advice on the following task. I have
some data that currently looks like this:
t1 <- data.frame(id=c(1,1,2,2),
aspect=c("A","B","A","B"), score=c(10,9,11,12))
I'd like it to look like this:
id A B
1 10 9
2 11 12
reshape() looks like a good candidate for this job but I'm
not really sure about the roles of timevar and idvar for
this dataframe. I tried
t2 <- reshape(t1, direction="wide", timevar=t1[,3],
idvar=t1[,2])
which is obviously ignorant and wrong.
Thank you in advance for any comments.
Regards,
Andrew C. Ward
CAPE Centre
Department of Chemical Engineering
The University of Queensland
Brisbane Qld 4072 Australia
More information about the R-help
mailing list