to_documents: Create Multiple Documents

Description Usage Arguments Value See Also Examples

View source: R/document.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
to_documents(documents, ...)

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

## S3 method for class '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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## 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)

## End(Not run)

news-r/textanalysis documentation built on Nov. 4, 2019, 9:40 p.m.