Get the number of lines in a text file using R

后端 未结 5 1264
伪装坚强ぢ
伪装坚强ぢ 2020-12-05 10:51

Is there a way to get the number of lines in a file without importing it?

So far this is what I am doing

myfiles <- list.files(pattern=\"*.dat\")
         


        
5条回答
  •  感动是毒
    2020-12-05 11:15

    I found this easy way using R.utils package

    library(R.utils)
    sapply(myfiles,countLines)
    

    here is how it works

提交回复
热议问题