powered by
Read in specified lines from a text file
get_lines(filename, line_numbers)
Returns a character vector with the specified lines.
character containing the filename of the file from which the lines should be read.
A vector containing the lines that should be read.
Line numbers larger than the number of lines in the file are ignored. Missing values are returned for these.
See readLines to read in all lines a text file; sample_lines can be used to read in random lines.
readLines
sample_lines
# Create temporary filename tmpcsv <- tempfile(fileext="csv") writeLines(letters[1:20], con=tmpcsv) get_lines(tmpcsv, c(1, 10)) # Cleanup file.remove(tmpcsv)
Run the code above in your browser using DataLab