Learn R Programming

tm.plugin.mail (version 0.0-1)

threads: E-Mail Threads

Description

Extract threads (i.e., chains of messages on a single subject) from e-mail documents.

Usage

threads(x)

Arguments

x
A corpus consisting of e-mails (MailDocuments).

Value

  • A list with the two named components ThreadID and ThreadDepth, listing a thread and the level of replies for each mail in the corpus x.

Details

This function uses a one-pass algorithm for extracting the thread information. I.e., reply mails appearing before their corresponding base mails are not detected, and are tagged with thread id NA and depth 2.

Examples

Run this code
require("tm")
newsgroup <- system.file("mails", package = "tm.plugin.mail")
news <- Corpus(DirSource(newsgroup), readerControl = list(reader = readMail))
sapply(news, ID)
lapply(news, function(x) grep("In-Reply-To", attr(x, "Header"), value = TRUE))
threads(news)

Run the code above in your browser using DataLab