[R] Data Frame Organization
Sam Charya
@@mch@ry@ @end|ng |rom y@hoo@com@@u
Mon Aug 26 21:48:39 CEST 2019
There is some issue with the plain text vs. HTML - please find the answer again. If illegible kindly see the attached pic.
Best Wishes.
s.
x <- c('A', 'B', 'C', 'A', 'B', 'C')
y <- c(10, 5, 9, 5, 15, 20)
df <- data.frame(x,y)
df
f <- reshape(df, v.names = "y", idvar = "x", timevar = "y", direction = "wide")
RESULT:
> f
x y.10 y.5 y.9 y.15 y.201 A 10 5 NA NA NA2 B NA 5 NA 15 NA3 C NA NA 9 NA 20
More information about the R-help
mailing list