Loading the data and libraries.

library(tidyverse)
library(here)

load(file = here::here("Data/Withings/2020-10-30_df_withings.Rdata"))

Absolute weights:

chart_weight <- ggplot(df_withings, aes(date, withings_weight)) +
  geom_line() +
  labs(
    title = "Body weight over time (in kg)",
    subtitle = "Source: Withings",
    x = "Date (MM-'YY)",
    y = "Weight (kg)"
  ) + 
  scale_x_date(breaks = "year", date_labels = "'%y") + 
  scale_y_continuous(breaks = seq(0, 200, 2.5)) +
  theme_light()
chart_weight

chart_fatmass <- ggplot(df_withings, aes(date, withings_fatmass)) +
  geom_line() +
  labs(
    title = "Fatmass over time (in kg)",
    subtitle = "Source: Withings",
    x = "Date (MM-'YY)",
    y = "Fatmass (kg)"
  ) + 
  scale_x_date(breaks = "year", date_labels = "'%y") + 
  scale_y_continuous(breaks = seq(0, 200, 2.5)) +
  theme_light()
chart_fatmass

chart_musclemass <- ggplot(df_withings, aes(date, withings_musclemass)) +
  geom_line() +
  labs(
    title = "Musclemass over time (in kg)",
    subtitle = "Source: Withings",
    x = "Date (MM-'YY)",
    y = "Musclemass (kg)"
  ) + 
  scale_x_date(breaks = "year", date_labels = "'%y") + 
  scale_y_continuous(breaks = seq(0, 200, 2.5)) +
  theme_light()
chart_musclemass

chart_bonemass <- ggplot(df_withings, aes(date, withings_bonemass)) +
  geom_line() +
  labs(
    title = "Bonemass over time (in kg)",
    subtitle = "Source: Withings",
    x = "Date (MM-'YY)",
    y = "Bonemass (kg)"
  ) + 
  scale_x_date(breaks = "year", date_labels = "'%y") + 
  scale_y_continuous(breaks = seq(0, 200, 2.5)) +
  theme_light()
chart_bonemass

chart_watermass <- ggplot(df_withings, aes(date, withings_watermass)) +
  geom_line() +
  labs(
    title = "Watermass over time (in kg)",
    subtitle = "Source: Withings",
    x = "Date (MM-'YY)",
    y = "Watermass (kg)"
  ) + 
  scale_x_date(breaks = "year", date_labels = "'%y") + 
  scale_y_continuous(breaks = seq(0, 200, 2.5)) +
  theme_light()
chart_watermass

chart_mass <- ggplot(df_withings, aes(date)) +
  geom_line(aes(y = withings_weight, colour = "Weight"), alpha = 0.5) +
  geom_line(aes(y = withings_musclemass, colour = "Musclemass"), alpha = 0.5) +
  geom_line(aes(y = withings_fatmass, colour = "Fatmass"), alpha = 0.5) +
  geom_line(aes(y = withings_bonemass, colour = "Bonemass"), alpha = 0.5) +
  geom_line(aes(y = withings_watermass, colour = "Watermass"), alpha = 0.5) +
  labs(
    title = "Body composition over time (in kg)",
    subtitle = "Source: Withings",
    x = "Date (MM-'YY)",
    y = "Kilogram (kg)"
  ) + 
  scale_x_date(breaks = "year", date_labels = "'%y") + 
  scale_y_continuous(breaks = seq(0, 200, 5)) +
  theme_light()
chart_mass 

Comparing these by using standardized values:

# First a for-loop to create the standardized datapoints:
for (i in 1:nrow(df_withings)) {
  df_withings$withings_weight_std[i] <- (df_withings$withings_weight[i] - mean(df_withings$withings_weight[0:i], na.rm = TRUE)) / sd(df_withings$withings_weight[0:i], na.rm = TRUE)
  df_withings$withings_fatmass_std[i] <- (df_withings$withings_fatmass[i] - mean(df_withings$withings_fatmass[0:i], na.rm = TRUE)) / sd(df_withings$withings_fatmass[0:i], na.rm = TRUE)
  df_withings$withings_musclemass_std[i] <- (df_withings$withings_musclemass[i] - mean(df_withings$withings_musclemass[0:i], na.rm = TRUE)) / sd(df_withings$withings_musclemass[0:i], na.rm = TRUE)
  df_withings$withings_bonemass_std[i] <- (df_withings$withings_bonemass[i] - mean(df_withings$withings_bonemass[0:i], na.rm = TRUE)) / sd(df_withings$withings_bonemass[0:i], na.rm = TRUE)
  df_withings$withings_watermass_std[i] <- (df_withings$withings_watermass[i] - mean(df_withings$withings_watermass[0:i], na.rm = TRUE)) / sd(df_withings$withings_watermass[0:i], na.rm = TRUE)
  }

# Chart that combines the standardized values over time:
chart_combined_std <- ggplot(df_withings, aes(date)) +
  geom_line(aes(y = withings_weight_std, colour = "Weight"), alpha = 0.5) +
  geom_line(aes(y = withings_musclemass_std, colour = "Musclemass"), alpha = 0.5) +
  geom_line(aes(y = withings_fatmass_std, colour = "Fatmass"), alpha = 0.5) +
  geom_line(aes(y = withings_bonemass_std, colour = "Bonemass"), alpha = 0.5) +
  labs(
    title = "Body composition (standardized values) over time",
    subtitle = "Source: Withings",
    x = "Date (MM-'YY)",
    y = "Number of SD's from the mean"
  ) + 
  scale_x_date(breaks = "month", date_labels = "%m-'%y", limits = c(as.Date("2020-01-01"), as.Date("2020-11-01"))) +  
  scale_color_discrete(name = "Variable", breaks = c("Weight","Fatmass","Musclemass","Bonemass")) + 
  geom_vline(xintercept = as.Date("2020-08-01"), linetype = 2) + 
  theme_light()
chart_combined_std

LS0tCnRpdGxlOiAiV2l0aGluZ3MgdmlzdWFsaXphdGlvbnMiCmF1dGhvcjogIkhlcm1hbiBkZSBWcmllcyIKZGF0ZTogIjMwLTEwLTIwMjAiCm91dHB1dDogaHRtbF9ub3RlYm9vawotLS0KCkxvYWRpbmcgdGhlIGRhdGEgYW5kIGxpYnJhcmllcy4KCmBgYHtyfQpsaWJyYXJ5KHRpZHl2ZXJzZSkKbGlicmFyeShoZXJlKQoKbG9hZChmaWxlID0gaGVyZTo6aGVyZSgiRGF0YS9XaXRoaW5ncy8yMDIwLTEwLTMwX2RmX3dpdGhpbmdzLlJkYXRhIikpCmBgYAoKQWJzb2x1dGUgd2VpZ2h0czoKCmBgYHtyfQpjaGFydF93ZWlnaHQgPC0gZ2dwbG90KGRmX3dpdGhpbmdzLCBhZXMoZGF0ZSwgd2l0aGluZ3Nfd2VpZ2h0KSkgKwogIGdlb21fbGluZSgpICsKICBsYWJzKAogICAgdGl0bGUgPSAiQm9keSB3ZWlnaHQgb3ZlciB0aW1lIChpbiBrZykiLAogICAgc3VidGl0bGUgPSAiU291cmNlOiBXaXRoaW5ncyIsCiAgICB4ID0gIkRhdGUgKE1NLSdZWSkiLAogICAgeSA9ICJXZWlnaHQgKGtnKSIKICApICsgCiAgc2NhbGVfeF9kYXRlKGJyZWFrcyA9ICJ5ZWFyIiwgZGF0ZV9sYWJ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