parse_ios {WhatsR}R Documentation

Parsing raw 'WhatsApp' chat log according to iOs text structure

Description

Creates a data frame from an exported 'WhatsApp' chat log containing one row per message and a column for DateTime when the message was send, name of the sender and body of the message. Only works as an intermediary function called from within parse_chat

Usage

parse_ios(
  chatlog,
  newline_indicator = "\n",
  media_omitted = "<media omitted>",
  media_indicator = "^<attached:\\s(.)*?\\.(.)*?>$",
  sent_location = paste0("location: (?=https:\\/\\/maps\\.google\\.com\\/",
    "\\?q=\\d\\d.\\d{6}\\,\\d\\.\\d{6})"),
  live_location = "^live location shared$",
  datetime_indicator = paste("(?!^)(?=\\[((\\d{2}\\.\\d{2}\\.\\d{2})|",
    "(\\d{1,2}\\/\\d{1,2}\\/\\d{2})),\\s\\d{1,2}\\:\\d{2}((\\:\\d{2}\\",
    "s(?i:(pm|am)))|(\\s(?i:(pm|am)))|(\\:\\d{2}\\])|(\\:\\d{2})|(\\s))\\])",
    sep = ""),
  newline_replace = " start_newline ",
  media_replace = " media_omitted ",
  foursquare_loc = "^.*: https://foursquare.com/v/.*$"
)

Arguments

chatlog

'WhatsApp' chat preprocessed by parse_chat

newline_indicator

Character string defining character for newline indicators. Default is a Unicode newline.

media_omitted

Character string inserted by 'WhatsApp' instead of file names when not exporting media.

media_indicator

Character string for detecting media and file attachments.

sent_location

Regex for detecting auto generated messages for locations shared via chat.

live_location

Regex for detecting auto generated messages for locations shared via chat.

datetime_indicator

Regex for detecting the DateTime indicator at the beginning of each message.

newline_replace

Replacement string for a newline character in parsed message. Default is " start_newline ".

media_replace

Replacement string for omitted media files. Default is " media_omitted ".

foursquare_loc

Regex for detecting sent Locations as FourSquare Links.

Value

A data frame containing the timestamp, name of the sender and message body

Examples

ParsedChat <- parse_ios("[29.01.18, 23:33:00] Alice: Hello?\\n [29.01.18, 23:45:01] Bob: Hello")

[Package WhatsR version 1.0.4 Index]