library(ggplot2)## Warning: package 'ggplot2' was built under R version 3.5.3
library(dplyr)## Warning: package 'dplyr' was built under R version 3.5.3
Make sure your data and R Markdown files are in the same directory. When loaded your data file will be called brfss2013. Delete this note when before you submit your work.
load("brfss2013.RData")The Behavioral Risk Factor Surveillance System (BRFSS) is a project supported by 50 Federal States belonging to the USA, including the District of Columbia, Guam, and the Commonwealth of Puerto Rico. It is run by Population Health Surveillance Branch, under the Division of Population Health at the National Center for Chronic Disease Prevention and Health Promotion. It was framed to measure behavioral risk factors for population over 18. The BRFSS data collects information on preventive health practices and risk behaviors that are linked to chronic diseases. It includes tobacco use, HIV/AIDS knowledge and prevention, exercise, immunization, health status, healthy days - health-related quality of life, health care access, inadequate sleep, hypertension awareness, cholesterol awareness, chronic health conditions, alcohol consumption, fruits and vegetables consumption, arthritis burden, and seatbelt use. It has the following number of variables:
Research quesion 1: what gender predominates under veternas?
brfss2013 %>%
group_by(sex,veteran3) %>%
summarise(count =n())## Warning: Factor `sex` contains implicit NA, consider using
## `forcats::fct_explicit_na`
## Warning: Factor `veteran3` contains implicit NA, consider using
## `forcats::fct_explicit_na`
## Warning: Factor `sex` contains implicit NA, consider using
## `forcats::fct_explicit_na`
## # A tibble: 9 x 3
## # Groups: sex [3]
## sex veteran3 count
## <fct> <fct> <int>
## 1 Male Yes 55938
## 2 Male No 144940
## 3 Male <NA> 435
## 4 Female Yes 5507
## 5 Female No 284642
## 6 Female <NA> 306
## 7 <NA> Yes 1
## 8 <NA> No 1
## 9 <NA> <NA> 5
The graph shows that veterans smoke at least 100 cigarretes more than those who are not veterans and the table shows that there are 55938 males veterans and only 5507 females veterans
Research quesion 2: who have better general health conditions, men or women?
brfss2013 %>%
group_by(sex,genhlth) %>%
summarise(count =n())## Warning: Factor `sex` contains implicit NA, consider using
## `forcats::fct_explicit_na`
## Warning: Factor `genhlth` contains implicit NA, consider using
## `forcats::fct_explicit_na`
## Warning: Factor `sex` contains implicit NA, consider using
## `forcats::fct_explicit_na`
## # A tibble: 15 x 3
## # Groups: sex [3]
## sex genhlth count
## <fct> <fct> <int>
## 1 Male Excellent 35741
## 2 Male Very good 65135
## 3 Male Good 62998
## 4 Male Fair 25882
## 5 Male Poor 10713
## 6 Male <NA> 844
## 7 Female Excellent 49740
## 8 Female Very good 93940
## 9 Female Good 87557
## 10 Female Fair 40844
## 11 Female Poor 17238
## 12 Female <NA> 1136
## 13 <NA> Excellent 1
## 14 <NA> Very good 1
## 15 <NA> <NA> 5
The graph shows that the less you earn, the higher the probability to be be Diagnosed With Angina Or Coronary Heart Disease An we see that 35741 men have excellent general health whereas 49740 women have excellent general health. That means, women are better off than men and maybe that´s why they live longer
Research quesion 3:
Are those Who smoke at least 100, men or women? and who are in better health conditions based on Number Of Days Physical Health Not Good
ggplot(brfss2013, aes(x=sex, fill=smoke100)) +geom_bar(position = "fill")brfss2013 %>%group_by(sex,physhlth) %>%
summarise(count =n())## Warning: Factor `sex` contains implicit NA, consider using
## `forcats::fct_explicit_na`
## # A tibble: 68 x 3
## # Groups: sex [3]
## sex physhlth count
## <fct> <int> <int>
## 1 Male 0 131861
## 2 Male 1 8106
## 3 Male 2 10403
## 4 Male 3 6016
## 5 Male 4 3176
## 6 Male 5 4977
## 7 Male 6 971
## 8 Male 7 3080
## 9 Male 8 536
## 10 Male 9 130
## # ... with 58 more rows
The graph shows that males smoke at least 100 cigarrets more than females and that women are in better shape than men
In conclusion, women are better off than men.