Apple Health Data Exploration

Using The Apple Health Kit and R to Track My Biometrics

David Williams

Introduction

I have been tracking some of my biometric data in Apple Health Kit since 2014. Some benefits of Healthkit are:

  • Central repository of health data where many apps can augment:
    • Myfitnesspal for nutritional info
    • Caffine Tracker Apps
  • Central repository where devices can augment and interact:
    • The Apple Watch is very easy to wear and it collects some useful activity metrics
    • Bluetooth heart rate monitors
    • UP24 for sleep monitoring

Healthkit is great to collect data and it does allow a complete export of the data in XML though the format is hard to work with. Recently a new iOS app called QS Access was released which exports health data in a simple CSV file format. This now makes it very easy to create Biometric dashboards using R Studio. This presentation documents some of my initial results.

Summary of Body Weight Metrics

ahdata <- read.csv("Health Data.csv")
ahdata[ahdata == 0] <- NA
summary(ahdata$Body.Fat.Percentage....)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##  0.2260  0.2360  0.2400  0.2405  0.2460  0.2520     592
summary(ahdata$Weight..lb.)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##   198.6   203.0   205.5   205.2   207.3   210.0     522

Nutritional Macros Summary

summary(ahdata$Carbohydrates..mg.)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    8264   45240   89860  103300  141000  357300     622
summary(ahdata$Protein..g.)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##   1.274  35.380  77.190  76.920 110.500 204.100     622
summary(ahdata$Total.Fat..g.)
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max.     NA's 
##   0.8332  29.3700  55.4900  66.4500  78.5000 709.2000      623

Conclusions

This is a very promising start towards creating a comprehensive data driven dashboard for my health monitoring. I have created some initial charts that I plan on building out into a fully interactive dashboard.