Learn R Programming

tm.plugin.mail (version 0.2-2)

readMail: Read In an E-Mail Document

Description

Return a function which reads in an electronic mail document.

Usage

readMail(DateFormat = character())

Value

A function with the following formals:

elem

a named list with the component content which must hold the document to be read in.

language

a string giving the language.

id

a character giving a unique identifier for the created text document.

The function returns a MailDocument representing the text and metadata extracted from elem$content. The argument

id is used as fallback if no corresponding metadata entry is found in elem$content.

Arguments

DateFormat

A character vector giving date-time formats for the “Date” header field in the mail document. By default, the “basic” formats of RFC 5322 are tried.

Author

Ingo Feinerer

Details

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

See Also

Reader for basic information on the reader infrastructure employed by package tm.

strptime for date-time format specifications.

RFC 5322 (https://www.rfc-editor.org/rfc/rfc5322).

Examples

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

Run the code above in your browser using DataLab