ian ian - 1 month ago 4x
R Question

Getting the number of lines in a text file in R

I have text file I am reading into R. eack line of text is the full name of a NCDF4 file. i would like to get a count of the number of files recorded in the test file. Surley there is a little bit of code to do that simpley


As I understand it, you are simply trying to figure out how many lines are in your txt file. Is that correct? If so, something like this will work:

dat <- readLines(path/to/txtfile.txt)