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

# \donttest{ # 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")
#> 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
#> 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 [4 x 11] (S3: tbl_df/tbl/data.frame) #> $ date : POSIXct[1:4], format: "2011-07-08 12:08:34" "2011-07-08 12:08:34" ... #> $ message_ID : chr [1:4] NA NA NA NA #> $ in_reply_to : chr [1:4] NA NA NA NA #> $ references : chr [1:4] NA NA NA NA #> $ from : chr [1:4] "Author <author@example.com>" "Author <author@example.com>" "Author <author@example.com>" "Author <author@example.com>" #> $ to : chr [1:4] "Recipient <recipient@example.com>" "Recipient <recipient@example.com>" "Recipient <recipient@example.com>" "Recipient <recipient@example.com>" #> $ cc : chr [1:4] NA NA NA NA #> $ subject : chr [1:4] "Sample message 1" "Sample message 2" "Another sample message" "The last sample message." #> $ content : chr [1:4] "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" #> $ num_discussants: num [1:4] 1 1 1 1 #> $ weekday : Ord.factor w/ 7 levels "Sun"<"Mon"<"Tue"<..: 6 6 7 1
# }