flexdashboard::flex_dashboard: vertical_layout: fill source: embed
### Quantified Self
The Quantified Self, is called lifelogging, is a particular development by Gary Wolf and Kevin Kelly from Wired magazine, which started in 2007 and attempts to join innovation into information obtaining on parts of a people everyday life. Individuals gather information as far as nourishment expended, nature of encompassing air, disposition, skin conductance as an intermediary for excitement, beat oximetry for blood oxygen level, and execution, regardless of whether mental or physical. Wolf has depicted evaluated self will be “self-information through self-following technology”.[1]
I utilize the information extricated out from Apple wellbeing to play out the undertaking. The information gathered with Health application is in the configuration of XML. I utilized R to for information preparing and connected a few packages including ggplot2, plotly to deliver the representation of my health data. I will concentrate on primary points: Steps, Energy Burned, Distance, Heart Rate and make sense of inquiries regarding these subjects.
Questions 1) About Steps: How many steps I had in each months of 2018? and in Which days of the weekd and hour I am most Active?
About Energy burned: What is the relationship between Energy burned and steps?
About Distance: How many miles I had in 2018? Do distacne increase as steps increase?
About Heart Rate: What is my average rate in every hour?
Reference: [1]Gary, Wolf. “QS & The Macroscope”. Antephase.com. Retrieved 21 March 2014
Apple Watch
Health App
stepsbyday <- df[df$year==2018,]%>%
filter(type == 'HKQuantityTypeIdentifierStepCount')%>%
group_by(month, date)%>%
summarize(steps=sum(value))
#boxplot by month
plot_ly(stepsbyday, y = ~steps, color= ~month, type="box") %>%
layout(title="Daily Steps I had in 2018 by Month", yaxis=list(title="Steps"), xaxis=list(title="month"))
## Warning in RColorBrewer::brewer.pal(N, "Set2"): n too large, allowed maximum for palette Set2 is 8
## Returning the palette you asked for with that many colors
## Warning in RColorBrewer::brewer.pal(N, "Set2"): n too large, allowed maximum for palette Set2 is 8
## Returning the palette you asked for with that many colors
#heatmap by hour
p <- df %>%
filter(type == 'HKQuantityTypeIdentifierStepCount') %>%
group_by(dayofweek,hour) %>%
summarize(steps=sum(value)) %>%
ggplot(aes(dayofweek, hour, fill = steps)) +
geom_tile() +
scale_fill_continuous(labels = scales::comma, low = 'blue', high = 'green')
ggplotly(p)
The two plots summarize the steps I had by different time horizon. First plot is a box plot by months in 2018. It seems that I am active through out the month of Oct to Dec due to winter. The second plot is a heat map that count steps I have in each hour by days of the week. We can say that i walked on Tuesday with 60K steps at 3 hours.
Row {data-height=850}
energyburnbyday<-df %>%
filter(type == 'HKQuantityTypeIdentifierActiveEnergyBurned') %>%
group_by(dayofweek,month,date,year) %>%
summarize(energy=sum(value))
#relationship between steps and energy burn
df2<-merge(stepsbyday,energyburnbyday,by="date")
ggplot(df2, aes(x = steps, y = energy)) +
geom_point() +
stat_smooth(method = "lm", col = "blue") +
ylab("energy burned")
Row {data-height=150}
This plot had issues.
### How many miles I had in 2019?
#distance 2019
distancebyday<-df %>%
filter(type == 'HKQuantityTypeIdentifierDistanceWalkingRunning') %>%
group_by(dayofweek,month,date,year) %>%
summarize(distance=sum(value))
plot_ly(data = distancebyday[distancebyday$year==2019,], x = ~month, y = ~distance, type="bar",color = ~dayofweek, colors = "Set2")%>%
layout(yaxis = list(title = 'distance(miles)'), barmode = 'stack', title="walking+running distance in 2019")
### We can say that on an average i walk 110 miles a month.
#steps and distance
df3<-merge(stepsbyday,distancebyday,by="date")
plot_ly(df3[df3$year==2018,], x = ~steps, y = ~distance, type="scatter",
mode = "markers", color = ~dayofweek, size = ~distance, text = ~paste('date: ', date))
## Warning: `line.width` does not currently support multiple values.
## Warning: `line.width` does not currently support multiple values.
## Warning: `line.width` does not currently support multiple values.
## Warning: `line.width` does not currently support multiple values.
## Warning: `line.width` does not currently support multiple values.
## Warning: `line.width` does not currently support multiple values.
## Warning: `line.width` does not currently support multiple values.
### About the accumulated Distance From the above Graph we can say that distance covered and steps counts are directly proportion.
Row{data-height=850}
# average heart rate line plot
heartrate<-df %>%
filter(type == 'HKQuantityTypeIdentifierHeartRate') %>%
group_by(hour, dayofweek) %>%
summarize(hr=(mean(na.omit(value))))
hrdf<-heartrate[heartrate$dayofweek==heartrate$dayofweek[1],]
p<-plot_ly(y=hrdf$hr, x=hrdf$hour , type="scatter", mode="lines", name=heartrate$dayofweek[1])
for(i in 2:7)
{
hrdf<-heartrate[heartrate$dayofweek==heartrate$dayofweek[i],]
p<-add_trace(p, y=hrdf$hr, x=hrdf$hour , type="scatter", mode="lines", name=heartrate$dayofweek[i] )
}
p %>%layout(title="Average Heart Rate by hour",xaxis = list(title="time"), yaxis = list(title="heartrate"))
Row {data-height=150}
| ### About Heart rate The plot tells us that the average heart rate by hour in each days of the week is 74.There were some point where it was too high due to the activites. |
| Row {data-height=850} |