circleclust
is a collection of functions that facilitate the analysis of personal location data to decipher patterns in mobility using circular or directional statistics.
The circleclust()
function classifies coordinates into distinct spatiotemporal clusters based on circular variance, or the variability in the bearing between sequential points or dihedral angles. The underlying algorithm calculates circular variance within a moving window and classifies coordinates as either ‘static’ or ‘mobile’ based on departures from a threshold value.
The map below shows personal location data recorded while talking a stroll through the Cincinnati Zoo and Botanical Gardens. Purple dots represent periods of mobile activity and yellow dots represent periods of static activity at various exhibits.
Plotting the bearing (azimuth) between sequential points gives an under the hood look at how the algorithm classifies coordinates. We see a higher degree of variability in the bearings classified as ‘static’, while the purple ‘mobile’ bearings demonstrate a consistent trajectory.
impute_coords()
dt_aggregate()
move()
circleclust()
sf
object with wgs_sf()
and visualize with cluster_deck()
d_clusters <- zoo_trip %>%
impute_coords('Date_Time') %>%
dt_aggregate('Date_Time') %>%
move('Date_Time') %>%
circleclust('Date_Time', pl_dist_threshold = 25, show_circvar = TRUE)
wgs_sf(d_clusters) %>%
cluster_deck(fill_colour = 'activity_status')
To install circleclust
, use the following code:
devtools::install_github("wolfeclw/circleclust")