Displaying 3 results from an estimated 3 matches for "yourprocess".
Did you mean:
your_process
2005 Nov 27
2
'For each file in folder F do....'
Hello,
I have 2700 text files in a folder and need to apply
the same program/procedure to each individually. I'm
trying to find how to code something like:
For each file in <Folder> do {<Procedure>}
is there an easy way to do this? other suggestions?
I have tried to list all the files names in a vector
e.g.
>listfiles[1:10,1]
1 H:/Rtest/AXP.txt
2 H:/Rtest/BA.txt
3
2008 Dec 21
3
Globbing Files in R
Dear all,
For example I want to process set of files.
Typically Perl's idiom would be:
__BEGIN__
@files = glob("/mydir/*.txt");
foreach my $file (@files) {
# process the file
}
__END__
What's the R's way to do that?
- Gundala Viswanath
Jakarta - Indonesia
2008 Dec 29
0
Serial Correlation Test for Short Time Series
...> Typically Perl's idiom would be:
>
> __BEGIN__
> @files = glob("/mydir/*.txt");
>
> foreach my $file (@files) {
> # process the file
> }
> __END__
Something like this has been suggested in R-help before:
files <- dir()
results <- lapply(files, yourprocessing())
The dir function has path and pattern arguments to select the set of
files you want.
This works fine when there are no problems, but often I'll use a for
loop so problem files can be dealt with differently when necessary.
Perhaps something like this:
ProcessList <- dir(pattern=&quo...