Write to a Text File
write_text.Rd
Writes as UTF-8 encoding and with \n
line
endings on UNIX systems and \r\n
on Windows.
This avoids some of the unintended side-effects of
usethis::write_over()
with R-projects.
Arguments
- path
Path to target file. It is created if it does not exist, but the parent directory must exist.
- lines
Character vector of lines. For
write_union()
, these are lines to add to the target file, if not already present. Forwrite_over()
, these are the exact lines desired in the target file.- overwrite
logical(1)
. If file exists, over-write it?- n
integer. The (maximal) number of lines to read. Negative values indicate that one should read up to the end of input on the connection.
Functions
read_text()
: a convenient wrapper toreadLines()
with default UTF-8 encoding for reading text into an R session.