Jim, It worked! It wrote out the files, but unfortunately, it didn't work for the file headers. I should have mentioned this is what the headers look like: X0.Classical.10.11.1_.HuEx.1_0.st.v2..CEL After running your script, that header changes to: 10. I'd just like to remove the "X0." prefix or in the case of file 189 the "X188." prefix leaving: Classical.10.11.1_.HuEx.1_0.st.v2..CEL
Thank you so much for your help! I'll try playing with it myself, but if you have any further insights they would be greatly appreciated! Best, Christian T. Stackhouse | Graduate Student GBS Neuroscience Theme Department of Neurosurgery Department of Radiation Oncology UAB | The University of Alabama at Birmingham Hazelrig-Salter Radiation Oncology Center | 1700 6th Ave S | Birmingham, AL 35233 M: 919.724.6890 | ctsta...@uab.edu | cstackho...@uabmc.edu | ctsta...@gmail.com uab.edu Knowledge that will change your world ________________________________________ From: Jim Lemon <drjimle...@gmail.com> Sent: Tuesday, March 22, 2016 4:48 PM To: Christian T Stackhouse (Campus) Cc: r-help@r-project.org Subject: Re: [R] Help batch saving elements of a list into unique files Hi Christian, This untested script might get you going (assuming you want a CSV format): for(affdf in 1:length(out)) { names(out[[affdf]])<-lapply(strsplit(names(out[[affdf]]),"[.]"),"[",2) write.csv(out[[affdf]],file=paste("affymetrix",affdf,".txt",sep="")) } Jim On Wed, Mar 23, 2016 at 6:32 AM, Christian T Stackhouse (Campus) <ctsta...@uab.edu> wrote: > Hello! > > > The overall goal I have is taking a large data frame and splitting it into > several smaller data frames (preserving column headers) which I can save as > txt files to feed into my APACHE ANY23 server for conversion into RDF. > > > This is what I call to split up the original file: > > > out <- split(affymetrix, (seq(nrow(affymetrix))-1) %/% 140) > > > I have a list (out) of length 187 for which each element is a dataframe. I > want to iteratively save each data frame as a separate tab file with a naming > structure such as: affymetrix1.txt, affymetrix2.txt, ... affymetrix187.txt > > > Before that, I need to modify the headers to remove a prefix "X0. , X1., ... > X187." that was introduced during my original splitting. I need to remove all > characters before and including the first "." > > > If anyone has a better way of doing this, please let me know. Otherwise, help > with how to perform batch editing of the headers and batch saving of the > files would be greatly appreciated! > > > Best, > > Christian T. Stackhouse | Graduate Student > GBS Neuroscience Theme > Department of Neurosurgery > Department of Radiation Oncology > UAB | The University of Alabama at Birmingham > Hazelrig-Salter Radiation Oncology Center | 1700 6th Ave S | Birmingham, AL > 35233 > M: 919.724.6890 | ctsta...@uab.edu | cstackho...@uabmc.edu | > ctsta...@gmail.com > > uab.edu<http://uab.edu/> > Knowledge that will change your world > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.