[R] Creating a custom connection to read from multiple files
Tomas Kalibera
kalibera at nenya.ms.mff.cuni.cz
Thu Jan 20 11:32:23 CET 2005
Dear Prof Ripley,
thanks for your suggestions, it's very nice one can create custom
connections directly in R and I think it is what I need just now.
> However, what is wrong with reading a file at a time and combining the
> results in R using rbind?
>
Well, the problem is performance. If I concatenate all those files, they
have around 8MB, can grow to tens of MBs in near future.
Both concatenating and reading from a single file by scan takes 5
seconds (which is almost OK).
However, reading individual files by read.table and rbinding one by one
( samples=rbind(samples, newSamples ) takes minutes. The same is when I
concatenate lists manually. Scan does not help significantly. I guess
there is some overhead in detecting dimensions of objects in rbind (?)
or re-allocation or copying data ?
Best regards,
Tomas Kalibera
More information about the R-help
mailing list