Create multiple documents from a data.frame, or vector of characters.

to_documents(documents, ...)

# S3 method for character
to_documents(documents, ..., type = c("string",
  "token", "ngram"))

# S3 method for data.frame
to_documents(documents, ..., text, title = NULL,
  language = NULL, author = NULL, timestamp = NULL,
  type = c("string", "token", "ngram"))

Arguments

documents

A data.frame, or vector containing documents.

...

Not actually being used.

type

Type of *_document function to use, see documents.

text

Bare column name containing data.

title, language, author, timestamp

Bare column name to metadata to add to documents, see document_metadata .

Value

An object of class documents.

See also

documents to read a single document.

Examples

# NOT RUN {
init_textanalysis()

docs <- c(
  "This is a document.",
  "This is another document."
)
to_documents(docs)

docs_df <- tibble::tibble(
  txt = docs,
  title = c("A", "B")
)
to_documents(docs_df)
title_(docs_df)
# }