Use this function for importing and converting an mbox file into a tibble object.

read_mbox(mbox = NULL, file = NULL)

Arguments

mbox

Input mbox file.

file

Output RDS file if you want to save. The default is NULL, which is not saving the output as a file.

Value

Tibble object for the input mbox file will be returned.

Details

read_mbox

See example below.

References

https://en.wikipedia.org/wiki/Mbox

https://docs.python.org/3/library/mailbox.html

https://www.anaconda.com/download/

Examples

# Changing working directory to temp for the demonstration purpose only. setwd(tempdir()) library(mboxr) # Feeding an mbox file through read_mbox function: test <- system.file("extdata", "test1.mbox", package = "mboxr") data <- read_mbox(mbox = test, file = "output.rds") # Now you can use the imported file as a tibble. str(data)
#> Classes 'tbl_df', 'tbl' and 'data.frame': 2 obs. of 9 variables: #> $ date : POSIXct, format: "2011-07-08 12:08:34" "2011-07-08 12:08:34" #> $ message_ID : chr NA NA #> $ in_reply_to: chr NA NA #> $ references : chr NA NA #> $ from : chr "Author <author@example.com>" "Author <author@example.com>" #> $ to : chr "Recipient <recipient@example.com>" "Recipient <recipient@example.com>" #> $ cc : chr NA NA #> $ subject : chr "Sample message 1" "Sample message 2" #> $ content : chr "This is the body.\n>From (should be escaped).\nThere are 3 lines.\n" "This is the second body.\n"