Source file ⇒ Final_Project_Draft.Rmd

Introduction

For my STAT 184 Final Project, I decided to dive into my personal data since I haven’t had the opportunity to analyze it. There is plenty of consistency in the data since I’ve been wearing a FitBit since June 2015. There are probably only a handful of days that I didn’t wear the band. I downloaded my data from the online FitBit portal. FitBit breaks up your activity levels into Sedentary, Lightly Active Fairly Active and Very Active.

I was primarily interested in looking into the difference in my active lifestyle between the summer months and school year. I find that it is much easier to stay fit in the summer.

Data Wrangling

#Read all FitBit data
Oct <- read.csv(file = "october17.csv")
Sept <- read.csv(file = "Sept17FitbitData.csv")
August <- read.csv(file= "August.csv")
July <- read.csv(file= "July17.csv")
June <- read.csv(file= "June17.csv")

#add column for what month each day is a part of
Oct1 <- Oct %>%
  mutate(month = "October")
Sept1 <- Sept %>%
  mutate(month = "September")
Aug1 <- August %>%
  mutate(month = "August")
July1 <- July %>%
  mutate(month = "July")
June1 <- June %>%
  mutate(month = "June")

October Visualizations

I’d like to begin by analyzing the month of October 2017.

ggplot(Oct1, aes(x= Date, y= Distance)) + geom_point() + theme(axis.text.x = element_text(angle=30 , hjust=1)) 

ggplot(Oct1, aes(x= Date, y= Minutes.Fairly.Active)) + geom_point() + theme(axis.text.x = element_text(angle=30 , hjust=1)) 

Do I take the stairs more often in the summer or school year?

As I was interested in the average number of flights that I traveled throughout the month, I decided to use the summarise() function to find that answer for one month. I’m interested in finding it and comparing it to other months. More specifically, I’d like to compare average flights over the school months versus the summer.

Oct1 %>% 
  summarise(mean_flights_per_day_Oct17 = mean(Floors))
##   mean_flights_per_day_Oct17
## 1                   18.29032
Sept1 %>% 
  summarise(mean_flights_per_day_Sept17 = mean(Floors))
##   mean_flights_per_day_Sept17
## 1                    18.03333
July1 %>% 
  summarise(mean_flights_per_day_July17 = mean(Floors))
##   mean_flights_per_day_July17
## 1                    11.70968
June1 %>% 
  summarise(mean_flights_per_day_June17 = mean(Floors))
##   mean_flights_per_day_June17
## 1                    10.53333

This makes sense to me. This summer I worked at AB Global in New York, NY. The only flights of stairs that I climbed daily included the subway stations and the NYU gym. I was at a desk all between 7:30am and 5pm, 5 days per week and I was on the 40th floor of a Manhattan office building, needless to say, I wasn’t taking the stairs like I do in my residence hall and in many classroom buildings. The beauty of routine is evident by the fact that the averages between summer months and months during the academic year and so close!

Comparing Summer Months to the School Months

Evident by the frequency of lighter colored dots, I tend to walk up many more flights of stairs per day now, as compared to the summer. This aligns with the

#compare distance covered and flights of stairs walked over two months  
comp <- rbind(July1, Sept1)

ggplot(data=comp, aes(x=Date, y=Distance))+geom_point()+aes(colour=Floors)+facet_wrap(~month,ncol=4) + theme(axis.text.x = element_text(angle=30 , hjust=1)) 

In order to analyze all months together and compare separate times, I bind the data together.

#concatenate the two data frames
joined<- rbind(Aug1,Sept1)
#join academic months and separately combine 5 months 
school_joined<- rbind(Aug1,Sept1,Oct1)

summer_school<- rbind(June1,July1, Aug1, Sept1,Oct1)

The bar graph below shows the obvious difference in my activity levels from the last summer month to the first month of my junior year at Penn State.

ggplot(data=joined,aes(x=Date,y=Calories.Burned))+geom_bar(stat='identity',position='stack', width=.9) +xlab('Date') +ylab('Calories Burned') + theme(axis.text.x = element_text(angle=30 , hjust=1)) 

I am interested in seeing whether or not I tend to take the stairs more often when I am more active and in a “fitness” mindset or only lightly active.

ggplot(data=school_joined,aes(x=Distance,y=Minutes.Very.Active))+geom_point()+aes(colour=month)+aes(size=Floors) 

Additionally, during the summer months of my research internships, I have much less responsibility in the evenings than the school year. This can be visualized below by the large ranges of Very Active Minutes during the summer months, as compared to the small ranges during the year. I spent my summer evenings and weekends at the NYU gym and exploring the city on foot.

ggplot(data=summer_school,aes(x=Distance,y=Minutes.Very.Active))+geom_point()+aes(colour=Floors)+facet_wrap(~month,ncol=4)