read_txt {mclm}R Documentation

Read a text file into a character vector

Description

This function reads a text file and returns a character vector containing the lines in the text file.

Usage

read_txt(file, file_encoding = "UTF-8", line_glue = NA, ...)

Arguments

file

Name of the input file.

file_encoding

Encoding of the input file.

line_glue

A character vector or NA. If NA, the output is a character vector in which each input line is a separate item, as in readr::read_lines(). Otherwise, the output is a character vector of length 1 in which all input lines are concatenated, using the value of line_glue[1] as line separator and as end-of-last-line marker.

...

Additional arguments (not implemented).

Value

A character vector.

See Also

write_txt()

Other reading functions: read_assoc(), read_conc(), read_fnames(), read_freqlist(), read_tokens(), read_types()

Examples


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


[Package mclm version 0.2.7 Index]