## Warning: package 'tidyverse' was built under R version 4.2.3
## Warning: package 'ggplot2' was built under R version 4.2.3
## Warning: package 'tibble' was built under R version 4.2.3
## Warning: package 'tidyr' was built under R version 4.2.3
## Warning: package 'readr' was built under R version 4.2.3
## Warning: package 'purrr' was built under R version 4.2.3
## Warning: package 'dplyr' was built under R version 4.2.3
## Warning: package 'stringr' was built under R version 4.2.3
## Warning: package 'forcats' was built under R version 4.2.3
## Warning: package 'lubridate' was built under R version 4.2.3
Area 1: Healthcare does not appear to be consistently accessible today based on different factors. How accessible was healthcare in 2013 based on education level?
Area 2: Economic burden may exacerbate preexisting mental health concerns. In 2013, how did individuals with a depressive disorder and of varying employment statuses and sex feel stress due to the costs of rent?
Area 3: Tobacco use is known to be hazardous to health. How did tobacco use in 2013 vary based on marital status and weight of male respondents?
Area 1: Healthcare Access
brfss2013 %>%
count(educa) %>%
mutate(`Proportion (Percentage)`= round(n / 491775 * 100, 2)) %>%
rename(
`Education Level` = educa,
Total = n
)## Education Level Total
## 1 Never attended school or only kindergarten 677
## 2 Grades 1 through 8 (Elementary) 13395
## 3 Grades 9 though 11 (Some high school) 28141
## 4 Grade 12 or GED (High school graduate) 142971
## 5 College 1 year to 3 years (Some college or technical school) 134197
## 6 College 4 years or more (College graduate) 170120
## 7 <NA> 2274
## Proportion (Percentage)
## 1 0.14
## 2 2.72
## 3 5.72
## 4 29.07
## 5 27.29
## 6 34.59
## 7 0.46
brfss2013 %>%
count(medcost) %>%
mutate(`Proportion (Percentage)`= round(n / 491775 * 100, 2)) %>%
rename(
`Could not see doctor because of cost?` = medcost,
Total = n
)## Could not see doctor because of cost? Total Proportion (Percentage)
## 1 Yes 60107 12.22
## 2 No 430447 87.53
## 3 <NA> 1221 0.25
brfss2013 %>%
count(checkup1) %>%
mutate(`Proportion (Percentage)`= round(n / 491775 * 100, 2)) %>%
rename(
`Length of Time Since Last Routine Checkup` = checkup1,
Total = n
)## Length of Time Since Last Routine Checkup Total Proportion (Percentage)
## 1 Within past year 356228 72.44
## 2 Within past 2 years 57298 11.65
## 3 Within past 5 years 33674 6.85
## 4 5 or more years ago 33748 6.86
## 5 Never 4522 0.92
## 6 <NA> 6305 1.28
brfss2013 %>%
filter(medcost == "Yes") %>%
mutate(educa = fct_explicit_na(educa, "No Answer")) %>%
ggplot() +
geom_histogram(aes(x = educa, fill = educa), stat = "count") +
labs(
title = "Couldn't See a Doctor Due to Cost by Education Level",
x = "Education Level",
y = "Total",
fill = "Education Level"
) +
scale_y_continuous(breaks = seq(0, 20000, 1000)) +
theme_classic() +
theme(
axis.text.x = element_blank(),
axis.ticks.x = element_blank()
) ## Warning: There was 1 warning in `mutate()`.
## ℹ In argument: `educa = fct_explicit_na(educa, "No Answer")`.
## Caused by warning:
## ! `fct_explicit_na()` was deprecated in forcats 1.0.0.
## ℹ Please use `fct_na_value_to_level()` instead.
## Warning in geom_histogram(aes(x = educa, fill = educa), stat = "count"):
## Ignoring unknown parameters: `binwidth`, `bins`, and `pad`
brfss2013 %>%
filter(checkup1 != "Within past year") %>%
mutate(educa = fct_explicit_na(educa, "No Answer")) %>%
ggplot() +
geom_histogram(aes(x = educa, fill = educa), stat = "count") +
facet_wrap(~checkup1) +
labs(
title = "Length of Time Since Last Routine Checkup",
subtitle = "(Greater Than One Year)",
x = "Education Level",
y = "Total",
fill = "Education Level"
) +
scale_y_continuous(breaks = seq(0, 50000, 5000)) +
theme_classic() +
theme(
axis.text.x = element_blank(),
axis.ticks.x = element_blank(),
plot.subtitle = element_text(hjust = 0.5)
) ## Warning in geom_histogram(aes(x = educa, fill = educa), stat = "count"):
## Ignoring unknown parameters: `binwidth`, `bins`, and `pad`
Area 2: Mental Health
brfss2013 %>%
filter(addepev2 == "Yes" & !is.na(scntmony) & !is.na(sex)) %>%
ggplot() +
geom_bar(aes(x = scntmony, fill = sex), stat = "count", position = "dodge") +
labs(
title = "Frequency of Stress Experienced Due to Cost of Rent by Gender",
subtitle = "(Scored as Times over the Last 12 Months)",
x = "Stress Level",
y = "Total",
fill = "Sex"
) +
scale_y_continuous(breaks = seq(0, 4000, 400)) +
theme_classic() +
theme(plot.subtitle = element_text(hjust = 0.5)) Area 3: Tobacco Use
brfss2013 %>%
filter(sex == "Male") %>%
count(m_status) %>%
rename(
`Marital Status` = m_status,
Total = n
)## Marital Status Total
## 1 Married 114060
## 2 Single 85931
## 3 <NA> 1322
brfss2013 %>%
filter(sex == "Male") %>%
count(m_status, smokday2) %>%
mutate(
`Proportion (Percentage)` = round(n / 201313 * 100, 2)) %>%
rename(
`Marital Status` = m_status,
`Frequency of days now smoking?` = smokday2,
Total = n
)## Marital Status Frequency of days now smoking? Total Proportion (Percentage)
## 1 Married Every day 9739 4.84
## 2 Married Some days 3685 1.83
## 3 Married Not at all 41290 20.51
## 4 Married <NA> 59346 29.48
## 5 Single Every day 15245 7.57
## 6 Single Some days 5907 2.93
## 7 Single Not at all 24520 12.18
## 8 Single <NA> 40259 20.00
## 9 <NA> Every day 112 0.06
## 10 <NA> Some days 61 0.03
## 11 <NA> Not at all 259 0.13
## 12 <NA> <NA> 890 0.44
brfss2013 %>%
filter(sex == "Male") %>%
summarize(
`Average Weight` = mean(weight2),
`Median Weight` = median(weight2),
`Minimum Weight` = min(weight2),
`Maximum Weight` = max(weight2),
`Standard Deviation of Weight` = sd(weight2)
)## Average Weight Median Weight Minimum Weight Maximum Weight
## 1 99.87906 93 1 570
## Standard Deviation of Weight
## 1 48.49325
brfss2013 %>%
filter(sex == "Male") %>%
group_by(m_status, smokday2) %>%
summarize(
`Average Weight` = mean(weight2),
`Median Weight` = median(weight2),
`Minimum Weight` = min(weight2),
`Maximum Weight` = max(weight2),
`Standard Deviation of Weight` = sd(weight2)
) %>%
rename(
`Marital Status` = m_status,
`Frequency of days now smoking?` = smokday2
)## `summarise()` has grouped output by 'm_status'. You can override using the
## `.groups` argument.
## # A tibble: 12 × 7
## # Groups: Marital Status [3]
## `Marital Status` Frequency of days now smo…¹ `Average Weight` `Median Weight`
## <fct> <fct> <dbl> <dbl>
## 1 Married Every day 98.0 91
## 2 Married Some days 102. 93
## 3 Married Not at all 105. 99
## 4 Married <NA> 102. 97
## 5 Single Every day 91.5 83
## 6 Single Some days 93.9 85
## 7 Single Not at all 99.7 93
## 8 Single <NA> 96.3 88
## 9 <NA> Every day 83.1 78
## 10 <NA> Some days 86.0 83
## 11 <NA> Not at all 83.0 83
## 12 <NA> <NA> 56.7 58
## # ℹ abbreviated name: ¹`Frequency of days now smoking?`
## # ℹ 3 more variables: `Minimum Weight` <dbl>, `Maximum Weight` <dbl>,
## # `Standard Deviation of Weight` <dbl>
brfss2013 %>%
mutate(smokday2 = fct_explicit_na(smokday2, "No Answer")) %>%
filter(sex == "Male" & !is.na(m_status) & weight2 <= 200) %>%
ggplot() +
geom_boxplot(aes(x = smokday2, y = weight2, fill = m_status)) +
labs(
title = "Reported Weight (pounds) by Marital and Smoking Status",
x = "Smoking Status",
y = "Reported Weight (pounds)",
fill = "Marital Status"
) +
scale_y_continuous(breaks = seq(0, 200, 20)) +
theme_classic()