countLines

0th

Percentile

Counts the number of lines in a text file

Counts the number of lines in a text file by count the number of occurances of platform-independent newlines (CR, LF, and CR+LF [1]), including a last line with neither. An empty file has zero lines.

Usage
## S3 method for class 'default}(file, chunkSize=5e+07, ...)':
countLinesundefined

 file{A connection or a pathname.}
   chunkSize{The number of bytes read in each chunk.}
   ...{Not used.}

 Returns an non-negative integer.

 [object Object]

 pathname <- system.file("NEWS", package="R.utils");
n <- countLines(pathname);
n2 <- length(readLines(pathname));
stopifnot(n == n2);

 [1] Page Newline, Wikipedia, July 2008.
       http://en.wikipedia.org/wiki/Newline


programming
Aliases
  • countLines.default
  • countLines
Documentation reproduced from package R.utils, version 1.1.0, License: LGPL (>= 2.1)

Community examples

Looks like there are no examples yet.