With a month’s of Fitbit data, it’s about time to harvest for some insights from this technology packed wristband.
library(lubridate) library(dplyr) fitbitdata = read.csv('fitbit.csv') fitbitdata % mutate(dow = wday(Date)) fitbitdata$dowlabel <- factor(fitbitdata$dow,levels=1:7,labels=c("Mon","Tue","Wed","Thu","Fri","Sat","Sun"),ordered=TRUE) fitbitdata$scyl <- as.factor(as.integer(fitbitdata$distance)/max(fitbitdata$distance)) head(fitbitdata) c1 <- rainbow(7) c2 <- rainbow(7, alpha=0.4) c3 <- rainbow(7, v=0.8) boxplot(fitbitdata$steps~fitbitdata$dowlabel, col=c2, medcol=c3, whiskcol=c1, staplecol=c3, boxcol=c3, outcol=c3, pch=23, cex=2, alpha=fitbitdata$scyl)
Number of steps and distance traveled data per day is collected from the Fitbit’s phone app, converted into CSV format, and then uploaded to R for data analysis. With a few lines of R code to draw a box-plot for day of week analysis, this data set with a third part statistical package will fill the gap until the Fitbit App offers something more sophisticated .