| str_write_lines | R Documentation |
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().
str_write_lines(string, con, encoding = "UTF-8", sep = "\n")
string |
A character vector to write. |
con |
A file name or a connection opened in binary mode. |
encoding |
A single string giving the output encoding. |
sep |
A single string written after each element. Defaults to |
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.
string, invisibly and unchanged.
str_read_lines(); stringi::stri_write_lines(), which writes
an empty file instead of signalling an error for missing values.
path <- tempfile()
str_write_lines(c("first", "second"), path)
str_read_lines(path, encoding = "UTF-8")
unlink(path)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.