powered by
Determine number of lines in a text file
determine_nlines(filename)
character containing the filename of the file of which the lines are to be counted.
Returns the number of lines in the file.
The routine counts the number of line endings. If the last line does not end in a line ending, but does contain character, this line is also counted.
The file size is not limited by the amount of memory in the computer.
See readLines to read in all lines a text file; get_lines and sample_lines can be used to read in spcified, or random lines.
readLines
get_lines
sample_lines
# NOT RUN { # Generate file writeLines(letters[1:20], con="tmp.csv") # Count the lines determine_nlines("tmp.csv") # }
Run the code above in your browser using DataLab