str_write_lines() writes each element of string followed by sep,
including the last one, and converts the output to encoding. It is the
counterpart of str_read_lines().
Details
Missing values are an error. Strings marked with the "bytes" encoding
are an error, as in str_c(). Characters that the output encoding cannot
represent are written as that encoding's substitution character, with a
warning.
See also
str_read_lines(); stringi::stri_write_lines(), which writes
an empty file instead of signalling an error for missing values.
Examples
path <- tempfile()
str_write_lines(c("first", "second"), path)
str_read_lines(path, encoding = "UTF-8")
#> [1] "first" "second"
unlink(path)