On 12/22/2008 1:14 PM, Earl F Glynn wrote:
Gundala Viswanath wrote:
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 <- lappl
Gundala Viswanath wrote:
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
Sys.glob is much more direct
Education of you might find exploring the power of?? (e.g. ??glob)
educational.
On Sun, 21 Dec 2008, Douglas Bates wrote:
On Sun, Dec 21, 2008 at 9:35 AM, Gundala Viswanath wrote:
Dear all,
For example I want to process set of files.
Typically Perl's id
Try this:
file.names <- dir(pattern = glob2rx("/mydir/*.txt"))
for(fn in file.names) {
DF <- read.table(fn, ...)
...
}
Another possibility is:
file.names <- .. as above ...
out <- lapply(file.names, function(fn) {
DF <- read.table(fn, ...)
...
})
out will have one component per file f
On Sun, Dec 21, 2008 at 9:35 AM, Gundala Viswanath wrote:
> 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 d
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
_
6 matches
Mail list logo