Data Frame Organization

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Data Frame Organization

R help mailing list-2
 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
 
______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.