Learn R Programming

stringb (version 0.1.17)

text_write: write text to file

Description

A generic function to write text to file (or a connections) and accompanying methods that wrap writeLines to do so. In contrast to vanilla writeLines() text_write() (1) is a generic so methods, handling something else than character vectors, can be implemented (2) in contrast to writeLines()' default to transform to write text in the system locale text_write() will default to UTF-8 no matter the locale (3) furthermore this encoding can be changed to any encoding supported by iconv (see also inconvlist iconv)

Usage

text_write(string, file, sep = "\n", encoding = "UTF-8", ...)

# S3 method for default text_write(string, file, sep = "\n", encoding = "UTF-8", ...)

Arguments

string

text to be written

file

file name or file path or an connections object - passed through to writeLines()'s con argument

sep

character to separate lines (i.e. vector elements) from each other - passed through to writeLines()'s con argument

encoding

encoding in which to write text to disk

...

further arguments that might be passed to methods (not used at the moment)