View source: R/sandbox-corpus.R
| sandbox_corpus | R Documentation |
Generates a reproducible corpus of synthetic RFC 822 messages
to be stored in a mailbox with populate_sandbox, so that the
package's searching, fetching, and decoding features can be demonstrated
and tested without a real mail account – typically against the local
Docker IMAP sandbox shipped in system.file("docker", package =
"mRpostman").
sandbox_corpus(n = 200, seed = 3501)
n |
Number of messages to generate. Default is |
seed |
An integer used as the RNG seed. The same |
Message features are spread so that each capability of the package
has matching messages to act upon: Date: headers spread over 2020
(SENTBEFORE/SENTSINCE/SENTON searches); a subset of
large bodies (LARGER/SMALLER searches); accented subjects in
MIME encoded-words and quoted-printable bodies (header and body decoding);
CSV, PNG, and one-page PDF attachments – all generated deterministically
in base R – some with repeated filenames (attachment listing, fetching,
binary base64 decoding, and filename deduplication); and reply chains via
In-Reply-To/References (SORT and THREAD).
A list with two components: messages, a list of
n character vectors (the lines of each RFC 822 message); and
info, a data.frame with one row per message describing the
features embedded in it (from, subject, date,
is_utf8_body, is_large, has_attachment,
attachment_type ("csv", "png", "pdf", or
NA), is_reply, and the flags – seen,
flagged – that populate_sandbox will set after
appending).
Other sandbox:
enron_sandbox(),
ingest_maildir(),
populate_sandbox()
corpus <- sandbox_corpus(n = 5)
# the first synthetic message
cat(corpus$messages[[1]], sep = "\n")
# features embedded in each message
corpus$info
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.