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

# \donttest{ # 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")
#> Warning: path[1]="C:\Anaconda3\envs\bookworm/python.exe": The system cannot find the file specified
#> Warning: path[1]="C:\Anaconda3\envs\bookworm/python.exe": The system cannot find the file specified
# Now you can use the imported file as a tibble. str(data)
#> tibble [2 x 11] (S3: tbl_df/tbl/data.frame) #> $ date : POSIXct[1:2], format: "2011-07-08 12:08:34" "2011-07-08 12:08:34" #> $ message_ID : chr [1:2] NA NA #> $ in_reply_to : chr [1:2] NA NA #> $ references : chr [1:2] NA NA #> $ from : chr [1:2] "Author <author@example.com>" "Author <author@example.com>" #> $ to : chr [1:2] "Recipient <recipient@example.com>" "Recipient <recipient@example.com>" #> $ cc : chr [1:2] NA NA #> $ subject : chr [1:2] "Sample message 1" "Sample message 2" #> $ content : chr [1:2] "This is the body.\n>From (should be escaped).\nThere are 3 lines.\n" "This is the second body.\n" #> $ num_discussants: num [1:2] 1 1 #> $ weekday : Ord.factor w/ 7 levels "Sun"<"Mon"<"Tue"<..: 6 6
# }