PlainTextDocument: Plain Text Documents

Description Usage Arguments Value See Also Examples

View source: R/doc.R

Description

Create plain text documents.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
PlainTextDocument(x = character(0),
                  author = character(0),
                  datetimestamp = as.POSIXlt(Sys.time(), tz = "GMT"),
                  description = character(0),
                  heading = character(0),
                  id = character(0),
                  language = character(0),
                  origin = character(0),
                  ...,
                  meta = NULL,
                  class = NULL)

Arguments

x

A character string giving the plain text content.

author

a character string or an object of class person giving the author names.

datetimestamp

an object of class POSIXt or a character string giving the creation date/time information. If a character string, exactly one of the ISO 8601 formats defined by https://www.w3.org/TR/NOTE-datetime should be used. See parse_ISO_8601_datetime in package NLP for processing such date/time information.

description

a character string giving a description.

heading

a character string giving the title or a short heading.

id

a character string giving a unique identifier.

language

a character string giving the language (preferably as IETF language tags, see language in package NLP).

origin

a character string giving information on the source and origin.

...

user-defined document metadata tag-value pairs.

meta

a named list or NULL (default) giving all metadata. If set all other metadata arguments are ignored.

class

a character vector or NULL (default) giving additional classes to be used for the created plain text document.

Value

An object inheriting from class, PlainTextDocument and TextDocument.

See Also

TextDocument for basic information on the text document infrastructure employed by package tm.

Examples

1
2
3
4
5
(ptd <- PlainTextDocument("A simple plain text document",
                          heading = "Plain text document",
                          id = basename(tempfile()),
                          language = "en"))
meta(ptd)

Example output

Loading required package: NLP
<<PlainTextDocument>>
Metadata:  7
Content:  chars: 28
  author       : character(0)
  datetimestamp: 2017-06-05 01:13:57
  description  : character(0)
  heading      : Plain text document
  id           : file36a6354e1d3a
  language     : en
  origin       : character(0)

tm documentation built on April 7, 2021, 3:01 a.m.