Not completely clear what you want (it does not appear to be a conventional reshape) but try this:
> m <- matrix(c("A", "A", "B", "1", "2", "3"), 3, 2) > structure(do.call(cbind, lapply(tapply(m[,2], m[,1], c), ts)), tsp = NULL, > class = NULL) A B [1,] "1" "3" [2,] "2" NA On Sat, Feb 21, 2009 at 10:23 PM, Daren Tan <darenta...@gmail.com> wrote: > I tried cast and melt in reshape package, but still can't convert this data > frame m > > m > [,1] [,2] > [1,] "A" "1" > [2,] "A" "2" > [3,] "B" "3" > to this form. > > m1 > [,1] [,2] > [1,] "A" "B" > [2,] "1" "3" > [3,] "2" NA > Please help. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. > ______________________________________________ R-help@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.