Data discovery: seasonal speed

Just writing this one quickly as it’s been hanging around my browser tabs for weeks…

I wrote Taking steps (in XML) almost 7 years ago and once in a while, I still grab Apple Health data from my phone and play around with it in R for a few minutes. Sometimes, curve fitting to a cloud of points generates a surprise.

library(tidyverse)
library(xml2)
theme_set(theme_bw())

health_data <- read_xml("~/Documents/apple_health_export/export.xml")

ws <- xml_find_all(health_data, ".//Record[@type='HKQuantityTypeIdentifierWalkingSpeed']") %>% 
    map(xml_attrs) %>% 
    map_df(as.list)

ws %>% 
    mutate(Date = ymd_hms(creationDate), 
                  value = as.numeric(value)) %>% 
    ggplot(aes(Date, value)) + 
    geom_point(size = 1, alpha = 0.2, color = "grey70", fill = "grey70") + 
    geom_smooth() + 
    labs(y = "Walking speed (km/h)", 
    title = "Walking speed data", 
    subtitle = "Apple Health 2020 - 2023")

Result:

Huh. Looks seasonal. Looks faster in the (southern) winter. Has that been reported before? Sure has.

It didn’t impress everyone but I thought it was interesting.