try split(), e.g., dat <- data.frame(x = rnorm(12), y = runif(12), z = rep(1:4, 3)) dat split(dat[1:2], dat$z)
I hope it helps. Best, Dimitris ---- Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm ----- Original Message ----- From: "Knut Krueger" <[EMAIL PROTECTED]> To: "'R R-help'" <[EMAIL PROTECTED]> Sent: Tuesday, February 26, 2008 11:22 AM Subject: [R] Split data.frames depeding values of a column > Hello to all > is there a function wich splits a data.frame > (column1,column2,column3,....) > > into > data1 <-(column1,column3....) #column2 = 1 > data2 <-(column1,column3....) #column2 = 2 > data3 <-(column1,column3....) #column2 = 3 > ... > Regards Knut > > ______________________________________________ > 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. > Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ______________________________________________ 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.