Learn R Programming

polmineR (version 0.7.11)

mail: Send the result of an analysis by Email.

Description

Send out a mail with the statistical analysis included in an object attached as an xlsx-file.

Usage

mail(.Object, ...)

# S4 method for textstat mail(.Object, to = getOption("polmineR.email"), rows = 1L:min(250L, nrow(.Object)))

# S4 method for data.frame mail(.Object, to = getOption("polmineR.email"), filename = tempfile(fileext = ".xlsx"), rows = 1L:min(250L, nrow(.Object)))

# S4 method for kwic mail(.Object, to = getOption("polmineR.email"), rows = 1L:min(250L, nrow(.Object)))

Arguments

.Object

The object to deliver.

...

Further parameters.

to

An email-address, the recipient of the mail message.

rows

The number of rows of the table included in the Excel file to be sent (if NULL, the whole table will be sent).

filename

The filename of the (temporary) xlsx-file that is generated.

Details

The method translates the result table in the object provided into an Excel sheet and attaches the sheet to an Email which will be sent to the Email-address provided by the argument to. A pre-requirement is that the global options polmineR.smtp_port and polmineR.smtp_server are validly defined. See examples.

Please note: At this stage, authentication is not yet supported.

Examples

Run this code
# NOT RUN {
# Get all (global) options for the polmineR package
grep("polmineR", names(options()), value = TRUE)

# Get options that need to be set
getOption("polmineR.email")
getOption("polmineR.smtp_server")
getOption("polmineR.smtp_port")

# Sample options (let us imagine Donald Duck had a mail-account)
options("polmineR.email" = "donald.duck@duckmail.org")
options("polmineR.smtp_port" = "587")
options("polmineR.smtp_server" = "smtp.duckmail.org")

# This is how you send out results when options are set
# (Note: Mail servers that require authentication are not yet supported.)
# }
# NOT RUN {
y <- cooccurrences("REUTERS", query = "oil")
mail(y)

k <- kwic("REUTERS", query = "oil")
mail(k)
# }

Run the code above in your browser using DataLab