ifiles: Creates iterator over text files from the disk

Description Usage Arguments See Also Examples

Description

The result of this function usually used in an itoken function.

Usage

1
2
3
ifiles(file_paths, reader = readLines)

idir(path, reader = readLines)

Arguments

file_paths

character paths of input files

reader

function which will perform reading of text files from disk, which should take a path as its first argument. reader() function should return named character vector: elements of vector = documents, names of the elements = document ids which will be used in DTM construction. If user doesn't provied names character vector, document ids will be generated as file_name + line_number (assuming that each line is a document).

path

character path of directory. All files in the directory will be read.

See Also

itoken

Examples

1
2
3
current_dir_files = list.files(path = ".", full.names = TRUE)
files_iterator = ifiles(current_dir_files)
dir_files_iterator = idir(path = ".")


Search within the text2vec package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.