See FAQ "How can I save the result of each iteration in a loop into a separate file?" you will certainly find the the principle given therein can be applied the other way round or reading as well.

Uwe Ligges



On 21.12.2011 02:32, Debs Majumdar wrote:
Hi,

  I have a list of files in one of my working directories:

"chr17.chunk1.dose.fvd"

"chr17.chunk1.dose.fvi"
"chr17.chunk1.prob.fvd"

"chr17.chunk1.prob.fvi"

...........

.........
........

"chr17.chunk10.dose.fvd"

"chr17.chunk10.dose.fvi"
"chr17.chunk10.prob.fvd"

"chr17.chunk10.prob.fvi"

And I am using the *.dose files to convert the data into a text file.

For a singlefile, the following works:
chr17chunk1dose<- databel("chr17.chunk1.dose")

databel2text(databel=chr17chunk1dose, file="chr1_chunk1.dose.txt", 
NAString="NA", row.names=TRUE, col.names=TRUE, transpose=FALSE)

I am trying to do the conversion inside a loop for all the files at a time but 
can't figure out how to do it. Any hep is appreciated.

#### I am trying something like this:

flies<- list.files(pattern="dose")
for(i in files){
     dose<- databel(i)[[1]]
     databel2text<- (databel = dose,  file="chr17_chunk1.dose.txt", 
NAString="NA", row.names=TRUE, col.names=TRUE, transpose=FALSE)
     }


########



Thanks,

Debs


______________________________________________
R-help@r-project.org mailing list
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
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.

Reply via email to