Value Lookup from File without Slurping
r at quantide.com wrote:
Using file() is not a real reading of all the file. This function will simply open a connection to the file without reading it. countLines should do something lile "wc -l" from a bash shell
just for a test:
cat(rep('', 10^7), file='test.txt', fill=1)
library(R.utils)
system.time(countLines('test.txt'))
... and the file is just about 30MB (and it makes no real difference if
it is stuffed with newlines or not).
vQ