Learn R Programming

mclm (version 0.2.7)

read_tokens: Read a tokens object from a text file

Description

This function reads an object of the class tokens from a text file, typically stored with write_tokens(). The text file is assumed to contain one token on each line and not to have a header.

Usage

read_tokens(file, file_encoding = "UTF-8", ...)

Value

An object of class tokens.

Arguments

file

Name of the input file.

file_encoding

Encoding to read the input file.

...

Additional arguments (not implemented).

See Also

write_tokens()

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

Examples

Run this code
.old_wd <- setwd(tempdir())
(tks <- tokenize("The old man and the sea."))
write_tokens(tks, "file_with_tokens.txt")
(tks2 <- read_tokens("file_with_tokens.txt"))
setwd(.old_wd)

Run the code above in your browser using DataLab