[R] Fast way to determine number of lines in a file

Gabor Grothendieck ggrothendieck at gmail.com
Mon Feb 8 15:52:40 CET 2010


If you are willing to use an external program parse the result of:

> system("wc -l small.dat")
10 small.dat

On Windows there is a wc.exe program in the Rtools distribution.

On Mon, Feb 8, 2010 at 9:16 AM, Hadley Wickham <hadley at rice.edu> wrote:
> Hi all,
>
> Is there a fast way to determine the number of lines in a file?  I'm
> looking for something like count.lines analogous to count.fields.
>
> Hadley
>
> --
> http://had.co.nz/
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list