[R] [Help]:How to use "loop" to achieve this aim?

Jeffrey Spies jspies at virginia.edu
Fri Oct 1 22:25:07 CEST 2010


Correcting Karena's solution:

for(i in 1:22) {
chrn <- paste("chr",i,sep="")

chrn=MEDIPS.readAlignedSeqences(BSgenome="hg19", file=chrn,numrows=
?????)  # no quotes around chrn
chrn=MEDIPS.genomeVector(data=chrn, bin_size=50,extend=250)
frames=????? # I don't know how you get this variable
...
out_file <- paste("frames.chr", i, ".meth.txt", sep="") # dynamic file name
write.table(frames, file=out_file, sep="\t", quote=F, col.names=T,
row.names=F) # use var you just made
}

Replace the ???s.

Jeff.

On Fri, Oct 1, 2010 at 11:27 AM, qcshare <qcshare at gmail.com> wrote:
>
> It doesn't work...
> where should change?
> Thanks.
> --
> View this message in context: http://r.789695.n4.nabble.com/Help-How-to-use-loop-to-achieve-this-aim-tp2819894p2922193.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list