Re: [R] Running R Script on a Sequence of Files

2008-12-06 Thread Gustavo Carvalho
Thanks a lot! On Fri, Dec 5, 2008 at 5:54 PM, Gabor Grothendieck [EMAIL PROTECTED] wrote: Try this: dir()[!file.info(dir())$isdir] On Fri, Dec 5, 2008 at 2:30 PM, Gustavo Carvalho [EMAIL PROTECTED] wrote: Is there a way to list only the files in a given directory without passing

[R] Running R Script on a Sequence of Files

2008-12-05 Thread Chris Poliquin
Hi, I have about 900 files that I need to run the same R script on. I looked over the R Data Import/Export Manual and couldn't come up with a way to read in a sequence of files. The files all have unique names and are in the same directory. What I want to do is: 1) Create a list of

Re: [R] Running R Script on a Sequence of Files

2008-12-05 Thread Kyle.
Have you thought about using one of the Python/R interface modules? http://www.omegahat.org/RSPython/ http://rpy.sourceforge.net/ Admittedly, I have not had much success in getting these to work on my machine, but I know others who have. Kyle H. Ambert Graduate Student Department of Medical

Re: [R] Running R Script on a Sequence of Files

2008-12-05 Thread Ajay ohri
This is almost a macro problem. It could be done in SAS language using the WPS product (660 USD) I think. It is a familiar problem and I would be quite interested in the result. Is there any concept of Macros in R or a package to do the same. Regards, Ajay On Fri, Dec 5, 2008 at 11:31 PM,

Re: [R] Running R Script on a Sequence of Files

2008-12-05 Thread Barry Rowlingson
2008/12/5 Chris Poliquin [EMAIL PROTECTED]: Hi, I have about 900 files that I need to run the same R script on. I looked over the R Data Import/Export Manual and couldn't come up with a way to read in a sequence of files. The files all have unique names and are in the same directory.

Re: [R] Running R Script on a Sequence of Files

2008-12-05 Thread Bert Gunter
Gunter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris Poliquin Sent: Friday, December 05, 2008 10:02 AM To: r-help@r-project.org Subject: [R] Running R Script on a Sequence of Files Hi, I have about 900 files that I need to run the same R script

Re: [R] Running R Script on a Sequence of Files

2008-12-05 Thread Kyle.
Thanks, Barry. I'll use that in the future. ---Kyle. On Fri, Dec 5, 2008 at 11:01 AM, Barry Rowlingson [EMAIL PROTECTED] wrote: 2008/12/5 Chris Poliquin [EMAIL PROTECTED]: Hi, I have about 900 files that I need to run the same R script on. I looked over the R Data Import/Export

Re: [R] Running R Script on a Sequence of Files

2008-12-05 Thread Gabor Grothendieck
Use dir to get the names and then lapply over them with a custom anonymous function where L is a list of the returned values: # assumes file names are those in # current directory that end in .dat filenames - dir(pattern = \\.dat$) L - lapply(filenames, function(x) { DF - read.table(x,

Re: [R] Running R Script on a Sequence of Files

2008-12-05 Thread Philipp Pagel
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

Re: [R] Running R Script on a Sequence of Files

2008-12-05 Thread Gustavo Carvalho
Is there a way to list only the files in a given directory without passing pattern=... to list.files()? On Fri, Dec 5, 2008 at 5:10 PM, Kyle. [EMAIL PROTECTED] wrote: Thanks, Barry. I'll use that in the future. ---Kyle. On Fri, Dec 5, 2008 at 11:01 AM, Barry Rowlingson [EMAIL PROTECTED]

Re: [R] Running R Script on a Sequence of Files

2008-12-05 Thread Gabor Grothendieck
Try this: dir()[!file.info(dir())$isdir] On Fri, Dec 5, 2008 at 2:30 PM, Gustavo Carvalho [EMAIL PROTECTED] wrote: Is there a way to list only the files in a given directory without passing pattern=... to list.files()? On Fri, Dec 5, 2008 at 5:10 PM, Kyle. [EMAIL PROTECTED] wrote: Thanks,

Re: [R] Running R Script on a Sequence of Files

2008-12-05 Thread Jagat.K.Sheth
always keep possession of the ball ... :-) Cheers, Jagat -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ajay ohri Sent: Friday, December 05, 2008 12:59 PM To: Chris Poliquin Cc: r-help@r-project.org Subject: Re: [R] Running R Script on a Sequence of Files

Re: [R] Running R Script on a Sequence of Files

2008-12-05 Thread Ajay ohri
] [mailto:[EMAIL PROTECTED] On Behalf Of Ajay ohri Sent: Friday, December 05, 2008 12:59 PM To: Chris Poliquin Cc: r-help@r-project.org Subject: Re: [R] Running R Script on a Sequence of Files This is almost a macro problem. It could be done in SAS language using the WPS product (660 USD) I

Re: [R] Running R Script on a Sequence of Files

2008-12-05 Thread Steve_Friedman
It seems that you have 900 files with the same parameters in each file (I might be reading more between the lines here than you inferred). However if this is the case, why not import each of the files into a common database and then link the database using ODBC connectivity options. If that is