Files2Vec: Function for reading text files into R

Description Usage Arguments Value Note Examples

Description

This function reads in all files in a directory ending in .txt into R. The result is a character vector where each entry is a .txt file. The names of the resulting vector are derived from the names of the files.

Usage

1
Files2Vec(directory, ...)

Arguments

directory

A path to directory containing the files you want to read into R.

...

Other arguments to be passed to TmParallelApply. See note, below.

Value

Returns a character vector where each entry corresponds to a document.

Note

This function performs parallel computation by default. The default behavior is to use all available cores according to detectCores. However, this can be modified by passing the cpus argument when calling this function.

Examples

1
2
3
4
## Not run: 
my_text_vector <- Files2Vec("/path/to/my/data/")

## End(Not run)

ChengMengli/topic documentation built on May 31, 2019, 8:44 p.m.