[R] how to get how many lines there are in a file.

Marc Schwartz MSchwartz at MedAnalytics.com
Mon Dec 6 15:30:06 CET 2004


On Mon, 2004-12-06 at 22:12 +0800, Hu Chen wrote:
> hi all
> If I wanna get the total number of lines in a big file without reading
> the file's content into R as matrix or data frame, any methods or
> functions?
> thanks in advance.
> Regards

See ?readLines

You can use:

length(readLines("FileName"))

to get the number of lines read.

HTH,

Marc Schwartz




More information about the R-help mailing list