Let\'s say I have a data.frame like:
a <- c(1:10,1:10,1:10,1:10,1:10,1:10,1:10,1:10,1:10,1:10)
df <- data.frame(a,rnorm(100))
And I
Continuing from Joshua's answer, the plyr function to use is d_ply which does not expect to return anything. You can do something like this:
d_ply(df, .(a),
function(sdf) write.csv(sdf,
file=paste(sdf$a[[1]],".csv",sep="")))
The file argument to write.csv is constructed such that each subset gets a different filename.