I have a data frame with three columns, one coded as a factor. I would like
to separate my data out into separate data frames according to the factor
level. Below is a simple example to illustrate. I can get R to return the
data in the correct format but cannot work out how to get separate data
frames. I am a newcommer to programming in R so am not sure what I am
missing! Thanks, Emily

a<-seq(1,20, by=2)
b<-seq(1,30, by=3)
ID<-as.factor(c(1,1,1,2,2,2,3,3,3,3))
df<-data.frame(a,b,ID)
for(i in 1:length(unique(ID))) {
df2<-subset(df, select=a:b, ID==ID[i])
}

	[[alternative HTML version deleted]]

