This function is a drop-in replacement for readLines()
from disk files.
It always returns text in the UTF-8 encoding and never warns on missing EOL
on the last line.
try_read_lines_enc()
is a variant that returns an
empty character vector on error, with a warning.
read_lines_enc(
path,
file_encoding = "UTF-8",
n = -1L,
ok = TRUE,
skipNul = FALSE
)try_read_lines_enc(
path,
file_encoding = "UTF-8",
n = -1L,
ok = TRUE,
skipNul = FALSE
)
Path to the file
The encoding to assume for the input file.
integer. The (maximal) number of lines to read. Negative values indicate that one should read up to the end of input on the connection.
logical. Is it OK to reach the end of the connection before
n > 0
lines are read? If not, an error will be generated.
logical: should nuls be skipped?
readr::read_lines()
for a faster alternative.
Other file functions:
transform_lines_enc()
,
write_lines_enc()