write_txt: Write a character vector to a text file

Description Usage Arguments Value See Also Examples

Description

Writes a character vector to a text file, in such a way that the items in the character vector become lines in the text file.

Usage

1
2
3
4
write_txt(x,
          file = "",
          file_encoding = "UTF-8",
          paste_char = "\n")

Arguments

x

the character vector that is to be written to file

file

name of the input file

file_encoding

the encoding that is to be used in the output file.

paste_char

if paste.char is a character string, then this character string is used as end-of-line marker on disk. if paste_char is NA, no end-of-line markers are used.

Value

The function write_txt (invisibly) returns the value of its first argument x.

See Also

See also write_txt.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# create a small text
x <- "This is
a small
text."

# write the text to a text file
write_txt(x, "example-text-file.txt")

# read a text from file
y <- read_txt("example-text-file.txt")
y

wai-wong-reimagine/mclm documentation built on May 16, 2019, 9:12 p.m.