Fitbit Project
This project involved the analysis of the data from my own fitbit smart watch in order to display my skills in data manipulation, analysis + visualisation as well as the use of statistics, regression models + working with excel files. This project was designed myself.
The Fitbit data was downloaded from my online account.
The main fitbit account data was contained in xls files which included information on steps, distance, calories burned + minutes in different activity levels for each month.
The fitbit sleep data was downloaded separately and was contained in xls files which included information on total minutes asleep, number of awakenings + number of minutes in different stages of sleep for each month.
STAGE 1 - Data loading, cleaning + manipulation
Firstly, the data from all the excel files for the main fitbit data was loaded, converted to a data frame, and a new "Month" column was added so that the data could easily be filtered by month later on.
# Load required packages
library(readxl)
library(dplyr)
# Load main fitbit data for January 2023
excel_file <- "fitbit_jan_23.xls"
data_jan <- read_excel(excel_file)
# Check the data
head(data_jan)
summary(data_jan)
df_jan <- as.data.frame(data_jan)
# Create new month column
df_jan$new_column <- "January"
df_jan <- df_jan %>%
rename(Month = new_column)
# Check new column
head(df_jan)
# Load main fitbit data for Feburary 2023
excel_file_2 <- "fitbit_feb_23.xls"
data_feb <- read_excel(excel_file_2)
# Check the data
head(data_feb)
df_feb <- as.data.frame(data_feb)
# Create new month column
df_feb$new_column <- "February"
df_feb <- df_feb %>%
rename(Month = new_column)
# Check new column
head(df_feb)
# Load main fitbit data for March 2023
excel_file_3 <- "fitbit_mar_23.xls"
data_mar <- read_excel(excel_file_3)
# Check the data
head(data_mar)
df_mar <- as.data.frame(data_mar)
# Create new month column
df_mar$new_column <- "March"
df_mar <- df_mar %>%
rename(Month = new_column)
# Check new column
head(df_mar)
# Load main fitbit data for April 2023
excel_file_4 <- "fitbit_april_23.xls"
data_apr <- read_excel(excel_file_4)
# Check the data
head(data_apr)
df_apr <- as.data.frame(data_apr)
# Create new month column
df_apr$new_column <- "April"
df_apr <- df_apr %>%
rename(Month = new_column)
# Check the new column
head(df_apr)
# Load main fitbit data for May 2023
excel_file_5 <- "fitbit_may_23.xls"
data_may <- read_excel(excel_file_5)
# Check the data
head(data_may)
df_may <- as.data.frame(data_may)
# Add new month columnn
df_may$new_column <- "May"
df_may <- df_may %>%
rename(Month = new_column)
# Check the new data
head(df_may)
# Load main fitbit data for June 2023
excel_file_6 <- "fitbit_june_23.xls"
data_june <- read_excel(excel_file_6)
# Check data
head(data_june)
df_june <- as.data.frame(data_june)
# Create new month column
df_june$new_column <- "June"
df_june <- df_june %>%
rename(Month = new_column)
# Check new column
head(df_june)
# Load main fitbit data for July 2023
excel_file_7 <- "fitbit_july_23.xls"
data_july <- read_excel(excel_file_7)
# Check data
head(data_july)
df_july <- as.data.frame(data_july)
# Create new month column
df_july$new_column <- "July"
df_july <- df_july %>%
rename(Month = new_column)
# Check new column
head(df_july)
# Load main fitbit data for August 2023
excel_file_8 <- "fitbit_aug_23.xls"
data_aug <- read_excel(excel_file_8)
# Check data
head(data_aug)
df_aug <- as.data.frame(data_aug)
# Add new month column
df_aug$new_column <- "August"
df_aug <- df_aug %>%
rename(Month = new_column)
# Check new column
head(df_aug)
# Load main fitbit data for September 2023
excel_file_9 <- "fitbit_sep_23.xls"
data_sep <- read_excel(excel_file_9)
# Check data
head(data_sep)
df_sep <- as.data.frame(data_sep)
# Add new month column
df_sep$new_column <- "September"
df_sep <- df_sep %>%
rename(Month = new_column)
# Check new column
head(df_sep)
# Load main fitbit data for October 2023
excel_file_10 <- "fitbit_oct_23.xls"
data_oct <- read_excel(excel_file_10)
# Check data
head(data_oct)
df_oct <- as.data.frame(data_oct)
# Add new month column
df_oct$new_column <- "October"
df_oct <- df_oct %>%
rename(Month = new_column)
# Check new column
head(df_oct)
# Load main fitbit data for November 2023
excel_file_11 <- "fitbit_nov_23.xls"
data_nov <- read_excel(excel_file_11)
# Check data
head(data_nov)
df_nov <- as.data.frame(data_nov)
# Add new month column
df_nov$new_column <- "November"
df_nov <- df_nov %>%
rename(Month = new_column)
# Check new column
head(df_nov)
# Load main fitbit data for December 2023
excel_file_12 <- "fitbit_dec_23.xls"
data_dec <- read_excel(excel_file_12)
# Check data
head(data_dec)
df_dec <- as.data.frame(data_dec)
# Add new month column
df_dec$new_column <- "December"
df_dec <- df_dec %>%
rename(Month = new_column)
# Check new column
head(df_dec)