anna wrote:
Oh this is a great answer too thanks erik!

-----
Anna Lippel

It was really the same answer as Phil. Notice if you use a data.frame instead of a matrix, you don't have to recast to a 'matrix'-like form, and therefore the split call is a little simpler. Depending on what you're doing, it might or might not make sense.

initialDF <- data.frame(rbind(cbind(rep("A",3),seq(1,3)),cbind(rep("B",4),seq(1,4)),cbind(rep("C",3),seq(1,3))))

split(initialDF, initialDF[,1])

______________________________________________
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.

Reply via email to