[R] reading xcms files

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Aug 10 12:47:21 CEST 2007

On Fri, 10 Aug 2007, Roberto Olivares Hernandez wrote:

> Hi,
> I am using xcms library to read mass spectrum data. I generate objects 
> from CDF files using the command line
>>  SME10 <- xcmsRaw("SME_10.CDF")
> I have 50 CDF files with different name and I don't want to repeat the 
> command for each one. Is there any option to read all the files and 
> generate a corresponding object name?

Something like

for(f in Sys.glob("*.CDF")) assign(sub("\\.CDF$", "", f), xcmsRaw(f))

(untested, of course).

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list