Learn R Programming

mclm (version 0.2.7)

write_txt: Write a character vector to a text file

Description

This function writes a character vector to a text file. By default, each item in the character vector becomes a line in the text file.

Usage

write_txt(x, file = "", line_glue = "\n")

Value

Invisibly, x.

Arguments

x

A character vector.

file

Name of the output file.

line_glue

Character string to be used as end-of-line marker on disk or NA for no end-of-line marker (so that x becomes a single line).

See Also

read_txt()

Other writing functions: write_assoc(), write_conc(), write_fnames(), write_freqlist(), write_tokens(), write_types()

Examples

Run this code
.old_wd <- setwd(tempdir())
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
setwd(.old_wd)

Run the code above in your browser using DataLab