[R] Help batch saving elements of a list into unique files

Christian T Stackhouse (Campus) ctstackh at uab.edu
Tue Mar 22 20:32:15 CET 2016


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 | ctstackh at uab.edu | cstackhouse at uabmc.edu | ctstackh at gmail.com

uab.edu<http://uab.edu/>
Knowledge that will change your world


	[[alternative HTML version deleted]]



More information about the R-help mailing list