Read and plot Moov Swim data

Chat Wacharamanotham

2017-08-19

This vignette shows how to load and plot swim data from Moov sensor.

First, we load the Moov package as well as other useful packages

library(Moov)

library(tidyverse)
library(cowplot)

We’ll read data from user.db, parse swimming information, and plot swimming performance:

db_path <- "../private/Applications/moov.core/Library/Application Support/user_data/6234565289443328/user.db"

swimming <- parse_swimming(read_moov(db_path))

plot_grid(
  plot_swim_summary(swimming, "distance_per_stroke") + geom_smooth(method = "loess"),
  plot_swim_summary(swimming, "stroke_rate", ylim = NULL) + geom_smooth(method = "loess"),
  plot_swim_summary(swimming, "distance_m", ylim = NULL),
  ncol = 1
)

We can also read sensor data from a swim session and plot them out:

swimming_root <- "../private/Applications/moov.core/Library/Application Support/user_data/6234565289443328/swimming/"

data <- read_moov_swim_bin("swimming-k5y5pqbib17vbjqrh9gr16e", swimming_root)
plot_sensor_swim(data)