Learn R Programming

polmineR (version 0.8.0)

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.

Value

The method returns TRUE if the message has been sent out successfully, and FALSE, if not.

Details

The method translates the result table in the object provided into an Excel sheet (xlsx-file) 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 defined. See examples.

Please note: At this stage, explicit authentication is not yet supported, and mail delivery will fail if authentication fails. Depending on the authentication requirements of your mail server, explicit authentication is not necessary if your logged in via VPN to your organisation.

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