image:
###Deliverables 1. A clear summary of the business task 2. A description of all data sources used 3. Documentation of any cleaning or manipulation of data 4. A summary of your analysis 5. Supporting visualizations and key findings 6. Your top high-level content recommendations based on your analysis
###1. Summary of Business Task
Sršen knows that an analysis of Bellabeat’s available consumer data
would reveal more opportunities for growth. She has asked the marketing
analytics team to focus on a Bellabeat product and analyze smart device
usage data in order to gain insight into how people are already using
their smart devices. Then, using this information, she would like
high-level recommendations for how these trends can inform Bellabeat
marketing strategy.
###2. Data Sources Used Bellabeat’s available consumer data consisting of (18) .csv files focusing on Daily Activity, Daily Sleep, Daily Weight, and Daily Calories. Public Domain, dataset made available through Mobius. Previewed data in Google Sheets and loaded the zip file into RStudio Desktop. I cleaned, manipulated and created visualizations in RStudio Desktop. It should be noted that this data is not current.
###3.1.Documentation of any cleaning or manipulation of data
#loading to my environment
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.4.4 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.0
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(here)
## here() starts at D:/Users/Owner/Documents/Bellabeat Project in R
library(skimr)
library(lubridate)
library(formattable)
library(geosphere)
library(scales)
##
## Attaching package: 'scales'
##
## The following objects are masked from 'package:formattable':
##
## comma, percent, scientific
##
## The following object is masked from 'package:purrr':
##
## discard
##
## The following object is masked from 'package:readr':
##
## col_factor
library(timetk)
library(viridis)
## Loading required package: viridisLite
##
## Attaching package: 'viridis'
##
## The following object is masked from 'package:scales':
##
## viridis_pal
library(hrbrthemes)
library(ggpubr)
library(ggplot2)
#loading the datasets
daily_activity <- read_csv("D:/Users/Owner/Documents/Bellabeat Project in R/7307319/Fitabase_Data_Raw/dailyActivity_merged.csv")
## Rows: 940 Columns: 15
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): ActivityDate
## dbl (14): Id, TotalSteps, TotalDistance, TrackerDistance, LoggedActivitiesDi...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
daily_calories <- read_csv("D:/Users/Owner/Documents/Bellabeat Project in R/7307319/Fitabase_Data_Raw/dailyCalories_merged.csv")
## Rows: 940 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): ActivityDay
## dbl (2): Id, Calories
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
daily_intensities <- read_csv("D:/Users/Owner/Documents/Bellabeat Project in R/7307319/Fitabase_Data_Raw/dailyIntensities_merged.csv")
## Rows: 940 Columns: 10
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): ActivityDay
## dbl (9): Id, SedentaryMinutes, LightlyActiveMinutes, FairlyActiveMinutes, Ve...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
daily_steps <- read_csv("D:/Users/Owner/Documents/Bellabeat Project in R/7307319/Fitabase_Data_Raw/dailySteps_merged.csv")
## Rows: 940 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): ActivityDay
## dbl (2): Id, StepTotal
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
heartrate_seconds <- read_csv("D:/Users/Owner/Documents/Bellabeat Project in R/7307319/Fitabase_Data_Raw/heartrate_seconds_merged.csv")
## Rows: 2483658 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): Time
## dbl (2): Id, Value
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
hourly_calories <- read_csv("D:/Users/Owner/Documents/Bellabeat Project in R/7307319/Fitabase_Data_Raw/hourlyCalories_merged.csv")
## Rows: 22099 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): ActivityHour
## dbl (2): Id, Calories
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
hourly_intensities <- read_csv("D:/Users/Owner/Documents/Bellabeat Project in R/7307319/Fitabase_Data_Raw/hourlyIntensities_merged.csv")
## Rows: 22099 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): ActivityHour
## dbl (3): Id, TotalIntensity, AverageIntensity
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
hourly_steps <- read_csv("D:/Users/Owner/Documents/Bellabeat Project in R/7307319/Fitabase_Data_Raw/hourlySteps_merged.csv")
## Rows: 22099 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): ActivityHour
## dbl (2): Id, StepTotal
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
minute_calories <- read_csv("D:/Users/Owner/Documents/Bellabeat Project in R/7307319/Fitabase_Data_Raw/minuteCaloriesNarrow_merged.csv")
## Rows: 1325580 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): ActivityMinute
## dbl (2): Id, Calories
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
minute_intensities <- read_csv("D:/Users/Owner/Documents/Bellabeat Project in R/7307319/Fitabase_Data_Raw/minuteIntensitiesNarrow_merged.csv")
## Rows: 1325580 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): ActivityMinute
## dbl (2): Id, Intensity
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
minute_METs <- read_csv("D:/Users/Owner/Documents/Bellabeat Project in R/7307319/Fitabase_Data_Raw/minuteMETsNarrow_merged.csv")
## Rows: 1325580 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): ActivityMinute
## dbl (2): Id, METs
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
minute_sleep <- read_csv("D:/Users/Owner/Documents/Bellabeat Project in R/7307319/Fitabase_Data_Raw/minuteSleep_merged.csv")
## Rows: 188521 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): date
## dbl (3): Id, value, logId
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
minute_steps <- read_csv("D:/Users/Owner/Documents/Bellabeat Project in R/7307319/Fitabase_Data_Raw/minuteStepsNarrow_merged.csv")
## Rows: 1325580 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): ActivityMinute
## dbl (2): Id, Steps
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
sleep_day <- read_csv("D:/Users/Owner/Documents/Bellabeat Project in R/7307319/Fitabase_Data_Raw/sleepDay_merged.csv")
## Rows: 413 Columns: 5
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): SleepDay
## dbl (4): Id, TotalSleepRecords, TotalMinutesAsleep, TotalTimeInBed
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
weight_log <- read_csv("D:/Users/Owner/Documents/Bellabeat Project in R/7307319/Fitabase_Data_Raw/weightLogInfo_merged.csv")
## Rows: 67 Columns: 8
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): Date
## dbl (6): Id, WeightKg, WeightPounds, Fat, BMI, LogId
## lgl (1): IsManualReport
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#cleaning the datasets
daily_activity$ActivityDate=as.POSIXct(daily_activity$ActivityDate, format="%m/%d/%Y", tz=Sys.timezone())
daily_calories$ActivityDay=as.POSIXct(daily_calories$ActivityDay, format="%m/%d/%Y", tz=Sys.timezone())
daily_intensities$ActivityDay=as.POSIXct(daily_intensities$ActivityDay, format="%m/%d/%Y", tz=Sys.timezone())
daily_steps$ActivityDay=as.POSIXct(daily_steps$ActivityDay, format="%m/%d/%Y", tz=Sys.timezone())
heartrate_seconds$Time=as.POSIXct(heartrate_seconds$Time, format="%m/%d/%Y %I:%M:%S %p", tz=Sys.timezone())
hourly_calories$ActivityHour=as.POSIXct(hourly_calories$ActivityHour, format="%m/%d/%Y %I:%M:%S %p", tz=Sys.timezone())
hourly_intensities$ActivityHour=as.POSIXct(hourly_intensities$ActivityHour, format="%m/%d/%Y %I:%M:%S %p", tz=Sys.timezone())
hourly_steps$ActivityHour=as.POSIXct(hourly_steps$ActivityHour, format="%m/%d/%Y %I:%M:%S %p", tz=Sys.timezone())
minute_calories$ActivityMinute=as.POSIXct(minute_calories$ActivityMinute, format="%m/%d/%Y %I:%M:%S %p", tz=Sys.timezone())
minute_intensities$ActivityMinute=as.POSIXct(minute_intensities$ActivityMinute, format="%m/%d/%Y %I:%M:%S %p", tz=Sys.timezone())
minute_METs$ActivityMinute=as.POSIXct(minute_METs$ActivityMinute, format="%m/%d/%Y %I:%M:%S %p", tz=Sys.timezone())
minute_sleep$date=as.POSIXct(minute_sleep$date, format="%m/%d/%Y %I:%M:%S %p", tz=Sys.timezone())
minute_steps$ActivityMinute=as.POSIXct(minute_steps$ActivityMinute, format="%m/%d/%Y %I:%M:%S %p", tz=Sys.timezone())
sleep_day$SleepDay=as.POSIXct(sleep_day$SleepDay, format="%m/%d/%Y", tz=Sys.timezone())
weight_log$Date=as.POSIXct(weight_log$Date, format="%m/%d/%Y %I:%M:%S %p", tz=Sys.timezone())
#manipulating the datetime to roundup seconds
minute_sleep_roundup <- minute_sleep %>%
mutate(ActivityMinute = floor_date(date, unit = "minute"))
minute_sleep_roundup$date <- NULL #dropping the old column
head(minute_sleep_roundup)
## # A tibble: 6 × 4
## Id value logId ActivityMinute
## <dbl> <dbl> <dbl> <dttm>
## 1 1503960366 3 11380564589 2016-04-12 02:47:00
## 2 1503960366 2 11380564589 2016-04-12 02:48:00
## 3 1503960366 1 11380564589 2016-04-12 02:49:00
## 4 1503960366 1 11380564589 2016-04-12 02:50:00
## 5 1503960366 1 11380564589 2016-04-12 02:51:00
## 6 1503960366 1 11380564589 2016-04-12 02:52:00
# Merge datasets hourly
hourly_merged_temporary <- merge(hourly_calories, hourly_intensities, all = TRUE)
hourly_merged <- merge(hourly_merged_temporary, hourly_steps, all = TRUE)
head(hourly_merged)
## Id ActivityHour Calories TotalIntensity AverageIntensity
## 1 1503960366 2016-04-12 00:00:00 81 20 0.333333
## 2 1503960366 2016-04-12 01:00:00 61 8 0.133333
## 3 1503960366 2016-04-12 02:00:00 59 7 0.116667
## 4 1503960366 2016-04-12 03:00:00 47 0 0.000000
## 5 1503960366 2016-04-12 04:00:00 48 0 0.000000
## 6 1503960366 2016-04-12 05:00:00 48 0 0.000000
## StepTotal
## 1 373
## 2 160
## 3 151
## 4 0
## 5 0
## 6 0
# Merge datasets minutes
minute_merged_temporary <- merge(minute_calories,minute_intensities, all = TRUE)
minute_merged_temporary_1 <- merge(minute_merged_temporary, minute_METs, all = TRUE)
minute_merged_temporary_2 <- merge(minute_merged_temporary_1, minute_steps, all = TRUE)
minute_merged <- merge(minute_merged_temporary_2, minute_sleep_roundup, all = TRUE)
head(minute_merged)
## Id ActivityMinute Calories Intensity METs Steps value logId
## 1 1503960366 2016-04-12 00:00:00 0.7865 0 10 0 NA NA
## 2 1503960366 2016-04-12 00:01:00 0.7865 0 10 0 NA NA
## 3 1503960366 2016-04-12 00:02:00 0.7865 0 10 0 NA NA
## 4 1503960366 2016-04-12 00:03:00 0.7865 0 10 0 NA NA
## 5 1503960366 2016-04-12 00:04:00 0.7865 0 10 0 NA NA
## 6 1503960366 2016-04-12 00:05:00 0.9438 0 12 0 NA NA
# Merge daily_activity with sleep_day
daily_activity
## # A tibble: 940 × 15
## Id ActivityDate TotalSteps TotalDistance TrackerDistance
## <dbl> <dttm> <dbl> <dbl> <dbl>
## 1 1503960366 2016-04-12 00:00:00 13162 8.5 8.5
## 2 1503960366 2016-04-13 00:00:00 10735 6.97 6.97
## 3 1503960366 2016-04-14 00:00:00 10460 6.74 6.74
## 4 1503960366 2016-04-15 00:00:00 9762 6.28 6.28
## 5 1503960366 2016-04-16 00:00:00 12669 8.16 8.16
## 6 1503960366 2016-04-17 00:00:00 9705 6.48 6.48
## 7 1503960366 2016-04-18 00:00:00 13019 8.59 8.59
## 8 1503960366 2016-04-19 00:00:00 15506 9.88 9.88
## 9 1503960366 2016-04-20 00:00:00 10544 6.68 6.68
## 10 1503960366 2016-04-21 00:00:00 9819 6.34 6.34
## # ℹ 930 more rows
## # ℹ 10 more variables: LoggedActivitiesDistance <dbl>,
## # VeryActiveDistance <dbl>, ModeratelyActiveDistance <dbl>,
## # LightActiveDistance <dbl>, SedentaryActiveDistance <dbl>,
## # VeryActiveMinutes <dbl>, FairlyActiveMinutes <dbl>,
## # LightlyActiveMinutes <dbl>, SedentaryMinutes <dbl>, Calories <dbl>
sleep_day
## # A tibble: 413 × 5
## Id SleepDay TotalSleepRecords TotalMinutesAsleep
## <dbl> <dttm> <dbl> <dbl>
## 1 1503960366 2016-04-12 00:00:00 1 327
## 2 1503960366 2016-04-13 00:00:00 2 384
## 3 1503960366 2016-04-15 00:00:00 1 412
## 4 1503960366 2016-04-16 00:00:00 2 340
## 5 1503960366 2016-04-17 00:00:00 1 700
## 6 1503960366 2016-04-19 00:00:00 1 304
## 7 1503960366 2016-04-20 00:00:00 1 360
## 8 1503960366 2016-04-21 00:00:00 1 325
## 9 1503960366 2016-04-23 00:00:00 1 361
## 10 1503960366 2016-04-24 00:00:00 1 430
## # ℹ 403 more rows
## # ℹ 1 more variable: TotalTimeInBed <dbl>
daily_merged <- merge(x = daily_activity, y = sleep_day, by.x = c("Id", "ActivityDate"), by.y = c("Id", "SleepDay"), all = TRUE)
# FULL OUTTER JOIN
head(daily_merged)
## Id ActivityDate TotalSteps TotalDistance TrackerDistance
## 1 1503960366 2016-04-12 13162 8.50 8.50
## 2 1503960366 2016-04-13 10735 6.97 6.97
## 3 1503960366 2016-04-14 10460 6.74 6.74
## 4 1503960366 2016-04-15 9762 6.28 6.28
## 5 1503960366 2016-04-16 12669 8.16 8.16
## 6 1503960366 2016-04-17 9705 6.48 6.48
## LoggedActivitiesDistance VeryActiveDistance ModeratelyActiveDistance
## 1 0 1.88 0.55
## 2 0 1.57 0.69
## 3 0 2.44 0.40
## 4 0 2.14 1.26
## 5 0 2.71 0.41
## 6 0 3.19 0.78
## LightActiveDistance SedentaryActiveDistance VeryActiveMinutes
## 1 6.06 0 25
## 2 4.71 0 21
## 3 3.91 0 30
## 4 2.83 0 29
## 5 5.04 0 36
## 6 2.51 0 38
## FairlyActiveMinutes LightlyActiveMinutes SedentaryMinutes Calories
## 1 13 328 728 1985
## 2 19 217 776 1797
## 3 11 181 1218 1776
## 4 34 209 726 1745
## 5 10 221 773 1863
## 6 20 164 539 1728
## TotalSleepRecords TotalMinutesAsleep TotalTimeInBed
## 1 1 327 346
## 2 2 384 407
## 3 NA NA NA
## 4 1 412 442
## 5 2 340 367
## 6 1 700 712
# Analyze Other Tibbles
head(hourly_merged)
## Id ActivityHour Calories TotalIntensity AverageIntensity
## 1 1503960366 2016-04-12 00:00:00 81 20 0.333333
## 2 1503960366 2016-04-12 01:00:00 61 8 0.133333
## 3 1503960366 2016-04-12 02:00:00 59 7 0.116667
## 4 1503960366 2016-04-12 03:00:00 47 0 0.000000
## 5 1503960366 2016-04-12 04:00:00 48 0 0.000000
## 6 1503960366 2016-04-12 05:00:00 48 0 0.000000
## StepTotal
## 1 373
## 2 160
## 3 151
## 4 0
## 5 0
## 6 0
head(minute_merged)
## Id ActivityMinute Calories Intensity METs Steps value logId
## 1 1503960366 2016-04-12 00:00:00 0.7865 0 10 0 NA NA
## 2 1503960366 2016-04-12 00:01:00 0.7865 0 10 0 NA NA
## 3 1503960366 2016-04-12 00:02:00 0.7865 0 10 0 NA NA
## 4 1503960366 2016-04-12 00:03:00 0.7865 0 10 0 NA NA
## 5 1503960366 2016-04-12 00:04:00 0.7865 0 10 0 NA NA
## 6 1503960366 2016-04-12 00:05:00 0.9438 0 12 0 NA NA
###3.2. Documentation of any cleaning or manipulation of data Out of 33 people, how many used the device for activities such as Movement, Sleep, and Weight?
#find number of people who used device for activities of movement, sleep, and weight
max_active = n_distinct(daily_activity$Id)
max_sleep = n_distinct(sleep_day$Id)
max_weight = n_distinct(weight_log$Id)
df_active <- daily_merged %>%
filter(SedentaryMinutes < 1440) %>%
group_by(ActivityDate) %>%
summarize(user = sum(n_distinct(Id)))
df_active %>%
ggplot(mapping = aes(x=ActivityDate, y=user)) +
geom_line( color="grey") +
geom_point(shape=21, color="black", fill="#00cc00", linewidth=6) +
geom_smooth() +
labs(title = "Device Usage for Movement", subtitle = "Based on Devices with < 24 Hours of Idel Time", caption = "Red line equals max unique users. CC0: Public Domain, dataset made available through Mobius", y = "Active User") +
geom_hline(yintercept=as.integer(max_active), linetype="dashed", color = "red", linewidth=2)
## Warning in geom_point(shape = 21, color = "black", fill = "#00cc00", linewidth
## = 6): Ignoring unknown parameters: `linewidth`
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
df_sleep <- daily_merged %>%
filter(TotalSleepRecords >= 1) %>%
group_by(ActivityDate) %>%
summarize(user = sum(n_distinct(Id)))
df_sleep %>%
ggplot(mapping = aes(x=ActivityDate, y=user)) +
geom_line( color="grey") +
geom_point(shape=21, color="black", fill="#00cc00", linewidth=6) +
geom_smooth() +
labs(title = "Sleep Usage", subtitle = "Based off of device with at least one sleep event", caption = "Red line equals max unique users. CC0: Public Domain, dataset made available through Mobius", y = "Active User") +
geom_hline(yintercept = as.integer(max_sleep), linetype="dashed", color = "red", linewidth=2)
## Warning in geom_point(shape = 21, color = "black", fill = "#00cc00", linewidth
## = 6): Ignoring unknown parameters: `linewidth`
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
weight_log %>%
group_by(Date) %>%
summarize(user = sum(n_distinct(Id))) %>%
ggplot(mapping = aes(x=Date, y=user)) +
geom_line( color="grey") +
geom_point(shape=21, color="black", fill="#00cc00", linewidth=6) +
geom_smooth() +
labs(title = "Weight Tracking Usage", subtitle = "Based on device with at least one recorded weight event", caption = "Red line equals max unique users. CC0: Public Domain, dataset made available through Mobius", y = "Active User") +
geom_hline(yintercept = as.integer(max_weight), linetype="dashed", color = "red", linewidth=2)
## Warning in geom_point(shape = 21, color = "black", fill = "#00cc00", linewidth
## = 6): Ignoring unknown parameters: `linewidth`
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
###4.1. Summary of Analysis
###3.3. Documentation of any cleaning or manipulation of data What time of day was the device used?
#time of day usage
df_2<- hourly_merged %>%
group_by(time = format(ActivityHour, format = "%H:%M:%S")) %>%
drop_na() %>%
summarize(mean_steps = mean(StepTotal))
df_2 %>%
ggplot(aes(x=time, y=mean_steps)) +
geom_histogram(stat = "identity", fill='#00cc00') +
theme(axis.text.x = element_text(angle = 90)) +
labs(title="Average Steps/Hour", caption="CC0: Public Domain, dataset made available through Mobius", y = "Avg Steps")
## Warning in geom_histogram(stat = "identity", fill = "#00cc00"): Ignoring
## unknown parameters: `binwidth`, `bins`, and `pad`
###4.2. Summary of Analysis
###3.4. Documentation of any cleaning or manipulation of data Find any correlation between minutes sleeping, calories, and sedentary minutes.
#Sleep time vs. sedentary time vs. calories - is there a correlation?
ggplot(data=daily_merged, aes(x=TotalMinutesAsleep, y=SedentaryMinutes)) +
geom_point(color='#00cc00') +
geom_smooth() +
stat_cor(method = "pearson", label.x = 3, label.y = 30) +
labs(title="Minutes Sleeping vs. Sedentary Minutes", caption="CC0: Public Domain, dataset made available through Mobius")
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 530 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 530 rows containing non-finite values (`stat_cor()`).
## Warning: Removed 530 rows containing missing values (`geom_point()`).
ggplot(data=daily_merged, aes(x=TotalMinutesAsleep, y=Calories)) +
geom_point(color='#00cc00') +
geom_smooth() +
stat_cor(method = "pearson", label.x = 3, label.y = 30) +
labs(title="Minutes Sleeping vs. Calories", caption="CC0: Public Domain, dataset made available through Mobius")
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 530 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 530 rows containing non-finite values (`stat_cor()`).
## Warning: Removed 530 rows containing missing values (`geom_point()`).
###4.3. Summary of Analysis
* Negative correlation (-0.6) between sedentary minutes and total
minutes sleeping. People who moved more, slept more. * Based off of a
high P-value, there is no correlation between calories and total sleep
time.
###5. Supporting Visualizations and Key Findings
Please see documentation shown above.
###6. High-Level Content Recommendations Based on this Analysis