Learn R Programming

tm.plugin.mail (version 0.0-1)

readMail: Read In an E-Mail Document

Description

Return a function which reads in an electronic mail document.

Usage

readMail(DateFormat = "%d %B %Y %H:%M:%S", ...)

Arguments

DateFormat
The format of the Date header in the mail document.
...
Arguments for the generator function.

Value

  • A function with the signature elem, language, id:
  • elemA list with the two named elements content and uri. The first element must hold the document to be read in, the second element must hold a call to extract this document. The call is evaluated upon a request for load on demand.
  • languageA character vector giving the text's language.
  • idA character vector representing a unique identification string for the returned text document.
  • The function returns a MailDocument representing content.

Details

Formally this function is a function generator, i.e., it returns a function (which in turn reads in a mail document) with a well-defined signature, but can access passed over arguments (e.g., to specify the format of the Date header in the e-mail via DateFormat) via lexical scoping.

See Also

strptime for date format specifications.

Examples

Run this code
require("tm")
newsgroup <- system.file("mails", package = "tm.plugin.mail")
news <- Corpus(DirSource(newsgroup), readerControl = list(reader = readMail))
inspect(news)

Run the code above in your browser using DataLab