[R] how to get how many lines there are in a file.
andy_liaw at merck.com
Mon Dec 6 15:37:22 CET 2004
> From: Marc Schwartz
> 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:
> to get the number of lines read.
> Marc Schwartz
On a system equipped with `wc' (*nix or Windows with such utilities
installed and on PATH) I would use that. Otherwise length(count.fields())
might be a good choice.
More information about the R-help