mailGenerator: Email Generator

Description Usage Arguments Value Examples

View source: R/mailGenerator.R

Description

This function allows you to generate a k words email from a specific probability distribution, given the email is spam or not. Each word given the class of the email, is generated from a Bernoulli distribution.

Usage

1
2
mailGenerator(k = 5, spam = T, subsetSpam = matrix(c(1, 0, 0, 0, 0, 1, 1,
  0, 0, 0), nrow = 2, byrow = T), probSubsetSpam = c(0.8, 0.2))

Arguments

k

number of words in the email. Defaults is 5.

spam

is the email spam? Defaults to TRUE.

subsetSpam

matrix where each row is a configurations of words that have non-zero probability given that the email is spam. Defaults is matrix(c(1,0,0,0,0,1,1,0,0,0),nrow = 2, byrow = T).

probSubsetSpam

probability of the configurations in subsetSpam given the email is spam. The probabilities for the rest of configurations are set to 0. Defaults is c(0.8,0.2).

Value

If spam = T, returns one of the rows of subsetSpam, according to the probabilities in probSubsetSopam. If spam = F, returns a k words email, where each configuration is equally probable.

Examples

1

roinaveiro/acAra documentation built on May 27, 2019, 1:47 p.m.