Use this function for merging all mbox files into one tibble object.

merge_mbox_all(path = ".", file = NULL)

Arguments

path

A character vector of full path names; the default corresponds to the working directory, getwd. Tilde expansion (see path.expand) is performed. Missing values will be ignored.

file

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

Value

One tibble object for all the merged mbox files in your current directory will be returned.

Details

merge_mbox_all

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) test_path <- system.file("extdata", package = "mboxr") # Save your own RDS file as an output if you need it: data <- merge_mbox_all(path = test_path, file = "output.rds") # Now you can use the imported file as a tibble. str(data)
#> Classes 'tbl_df', 'tbl' and 'data.frame': 4 obs. of 9 variables: #> $ date : POSIXct, format: "2011-07-08 12:08:34" "2011-07-08 12:08:34" ... #> $ message_ID : chr NA NA NA NA #> $ in_reply_to: chr NA NA NA NA #> $ references : chr NA NA NA NA #> $ from : chr "Author <author@example.com>" "Author <author@example.com>" "Author <author@example.com>" "Author <author@example.com>" #> $ to : chr "Recipient <recipient@example.com>" "Recipient <recipient@example.com>" "Recipient <recipient@example.com>" "Recipient <recipient@example.com>" #> $ cc : chr NA NA NA NA #> $ subject : chr "Sample message 1" "Sample message 2" "Another sample message" "The last sample message." #> $ content : chr "This is the body.\n>From (should be escaped).\nThere are 3 lines.\n" "This is the second body.\n" "R is the best!\nLet's use R!\nGood bye.\n" "This is the last message.\nGood luck!!\n"