read.file: Read character vector from file

Description Usage Arguments Details See Also Examples

View source: R/utils.R

Description

read.file reads a file word by word and returns a unicode character vector.

Usage

1
read.file(text.file, max.length = -1, lower = FALSE, bow = FALSE, ...)

Arguments

text.file

A character vector. The path to the text file

max.length

A numeric. The maximum length of space delimited units to be read (defaults to the entire file).

lower

Boolean. Whether or not to lowercase all words.

bow

Boolean. Whether or not to substitute each word with an ID tag (useful for non-ASCII texts)

...

arguments to be passed to scan.

Details

The read.file helper function reads a character vector from a file up to max.length calling PreprocessText if nececssary to carry out any preprocessing steps.

See Also

scan, PreprocessText

Examples

1
2
3
4
5
## initialize a temp buffer
tmp.file <- file()
cat("this is a very nice and short sentence", file = tmp.file)
text <- read.file(tmp.file, max.length = 1000, lower = TRUE, bow = TRUE)
close(tmp.file)

dimalik/Hrate documentation built on July 29, 2017, 8:55 p.m.