Description Usage Arguments Value Author(s) See Also Examples
Returns the number of lines in a file, which in the case of a datafile will often correspond to the number of rows, or rows+1. Can also do this for all files in the directory. File equivalent of nrow()
1 |
fn |
name of the file(s) to get the length of |
dir |
optional path for fn location, or specify all files in dir |
all.in.dir |
select whether to extract length for all files in dir |
returns length of file (or all files)
Nicholas Cooper nick.cooper@cimr.cam.ac.uk
1 2 3 4 5 6 7 | orig.dir <- getwd(); setwd(tempdir()); # move to temporary dir
write.table(matrix(rnorm(100),nrow=10),"temp.txt",col.names=FALSE)
file.nrow("temp.txt")
# use with caution, will be slow if dir contains large files
# not run # file.nrow(all.in.dir=TRUE)
unlink("temp.txt")
setwd(orig.dir) # reset working directory to original
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.