Looking for insights from Fitbit data with R

With a month’s of Fitbit data, it’s about time to harvest for some insights from this technology packed wristband.

r-fitbit4


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)

r-fitbit3

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 .

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s