Skip to content
Prev 359525 / 398502 Next

Help batch saving elements of a list into unique files

Okay. Got some lunch, I can think about this with both halves of the brain.

drop_token1<-function(x) {
 return(paste(x[2:length(x)],sep="",collapse="."))
}
affnames<-c("X0.Classical.10.11.1_.HuEx.1_0.st.v2..CEL",
 "X1.Classical.10.11.1_.HuEx.1_0.st.v2..CEL")
affnames.split<-strsplit(affnames,"[.]")
lapply(affnames.split,drop_token1)
[[1]]
[1] "Classical.10.11.1_.HuEx.1_0.st.v2..CEL"

[[2]]
[1] "Classical.10.11.1_.HuEx.1_0.st.v2..CEL"

This what I get with a toy example. So, I think that:

for(affdf in 1:length(out)) {
names(out[[affdf]])<-lapply(strsplit(names(out[[affdf]]),"[.]),drop_token1)
write.csv(out[[affdf]],file=paste("affymetrix",affdf,".txt",sep=""))
}

should work.

Jim


On Wed, Mar 23, 2016 at 11:16 AM, Christian T Stackhouse (Campus)
<ctstackh at uab.edu> wrote:
Message-ID: <CA+8X3fWudm0yx0XtxtcAAq9j7fY3h0xNFvZ0OnqF2BBrF5UDLg@mail.gmail.com>
In-Reply-To: <BLUPR0701MB197081C2695234CCAF1C5A64C7810@BLUPR0701MB1970.namprd07.prod.outlook.com>