Write list of data.frames to separate CSV files with lapply

Try this:

sapply(names(df.daily), 
 function (x) write.table(df.daily[[x]], file=paste(x, "txt", sep=".") )   )

You should see the names (“1”, “2”, “3”) spit out one by one, but the NULLs are the evidence that the side-effect of writing to disk files was done. (Edit: changed [] to [[]].)

Leave a Comment