Skip to content
Back to formatted view

Raw Message

Message-ID: <20081205193003.GA8555@localhost>
Date: 2008-12-05T19:30:03Z
From: Philipp Pagel
Subject: Running R Script on a Sequence of Files
In-Reply-To: <d8ad40b50812051101j181d4e98q6dacab8c364833c8@mail.gmail.com>

>  I can't believe the two 'solutions' already posted. It's easy:

Me neither.
> 
>  ?list.files

That's what I would use, too. If the OP is on a UNIX platform,
run the R-script in a loop in the shell is an alternative.
Something like this (bourne shell syntax):

for datafile in *.csv ; do
	Rscript analyze.R $datafile
done

The R script (analyze.R) can use commandArgs() to read the filename
argument.

cu
	Philipp

-- 
Dr. Philipp Pagel
Lehrstuhl f?r Genomorientierte Bioinformatik
Technische Universit?t M?nchen
Wissenschaftszentrum Weihenstephan
85350 Freising, Germany
http://mips.gsf.de/staff/pagel