[R] help with looping a specific code

Haznadar, Majda (NIH/NCI) [E] majda.haznadar at nih.gov
Wed Jan 7 16:29:40 CET 2015


I would like to loop a specific code through multiple files ending in .CDF in the same directory, but I am unsure of how to do that (new to R).

Can someone please help me with this-thank you.

This is the code I would like to loop:

> xr<-xcmsRaw("mh141210xg2_sccs_00101.CDF", profstep=0)
> write.mzdata(xr, file="mh141210xg2_sccs_00101.CDF")

And there are 675 of these .CDF files in the directory that I would like to apply the code to. Also, when I save the file in the second line of code, I would like it to have the same name as it previously had, so just re-write the old file.

Thanks so much for your time!!

	[[alternative HTML version deleted]]

More information about the R-help mailing list