This function writes text to a file, optionally including a header at the top of the file. The text and the header are converted from Linux newline format to Windows newline format before writing.
Usage
write_text(
txt,
file = "",
header = "**THIS FILE IS CONSTANTLY OVERWRITTEN -- DO NOT MANUALLY EDIT**\r\n\r\n"
)
Arguments
- txt
A character string of text to be written to the file.
- file
A character string specifying the file path. Passed through to
base::cat
. Default is an empty string, which writes to the console.- header
An optional character string header to be inserted at the top of the text file. Default is
**THIS FILE IS CONSTANTLY OVERWRITTEN -- DO NOT MANUALLY EDIT**\r\n\r\n
.