plot_locations: Plotting locations sent in 'WhatsApp' chat logs on maps

View source: R/plot_locations.R

plot_locationsR Documentation

Plotting locations sent in 'WhatsApp' chat logs on maps

Description

Plots the location data that is sent in the 'WhatsApp' chatlog on an auto-scaled map. Requires unanonymized 'Location' column in data

Usage

plot_locations(
  data,
  names = "all",
  starttime = "1960-01-01 00:00",
  endtime = "2200-01-01 00:00",
  mapzoom = 5,
  return_data = FALSE,
  jitter_value = NA,
  jitter_seed = 12345,
  exclude_sm = FALSE
)

Arguments

data

A 'WhatsApp' chatlog that was parsed with parse_chatwith anonymize= FALSE or anonymize = "add".

names

A vector of author names that the plots will be restricted to.

starttime

Datetime that is used as the minimum boundary for exclusion. Is parsed with as.POSIXct. Standard format is "yyyy-mm-dd hh:mm". Is interpreted as UTC to be compatible with 'WhatsApp' timestamps.

endtime

Datetime that is used as the maximum boundary for exclusion. Is parsed with as.POSIXct. Standard format is "yyyy-mm-dd hh:mm". Is interpreted as UTC to be compatible with 'WhatsApp' timestamps.

mapzoom

Value for zoom into the map passed down to get_map. Default value is 5. Higher zoom will auto-download more map files which can take a while.

return_data

If TRUE, returns a data frame of LatLon coordinates extracted from the chat for more elaborate plotting. Default is FALSE.

jitter_value

Amount of random jitter to add to the geolocations to hide exact locations. Default value is 0.01. Can be NA for exact locations.

jitter_seed

Seed for adding random jitter to coordinates. Passed to set.seed

exclude_sm

If TRUE, excludes the 'WhatsApp' system messages from the descriptive statistics. Default is FALSE.

Value

Plots for geolocation and/or a data frame of latitude and longitude coordinates

Examples

data <- readRDS(system.file("ParsedWhatsAppChat.rds", package = "WhatsR"))
plot_locations(data)


gesiscss/WhatsR documentation built on Jan. 29, 2025, 11:55 a.m.