Setup

Load packages

library(tidyverse)
library(ggplot2)
library(dplyr)
library(here)
library(skimr)
library(janitor)

Load data

The data file has been updated according to the learner’s file labeling protocols. No columns or rows have been altered at this point.

load("c1w51_brfss2013.RData")
head(brfss2013)
##   X_state   fmonth   idate   imonth iday iyear            dispcode      seqno
## 1 Alabama  January 1092013  January    9  2013 Completed interview 2013000580
## 2 Alabama  January 1192013  January   19  2013 Completed interview 2013000593
## 3 Alabama  January 1192013  January   19  2013 Completed interview 2013000600
## 4 Alabama  January 1112013  January   11  2013 Completed interview 2013000606
## 5 Alabama February 2062013 February    6  2013 Completed interview 2013000608
## 6 Alabama    March 3272013    March   27  2013 Completed interview 2013000630
##        X_psu ctelenum pvtresd1 colghous stateres             cellfon3 ladult
## 1 2013000580      Yes      Yes     <NA>      Yes Not a cellular phone   <NA>
## 2 2013000593      Yes      Yes     <NA>      Yes Not a cellular phone   <NA>
## 3 2013000600      Yes      Yes     <NA>      Yes Not a cellular phone   <NA>
## 4 2013000606      Yes      Yes     <NA>      Yes Not a cellular phone   <NA>
## 5 2013000608      Yes      Yes     <NA>      Yes Not a cellular phone   <NA>
## 6 2013000630      Yes      Yes     <NA>      Yes Not a cellular phone   <NA>
##   numadult nummen numwomen   genhlth physhlth menthlth poorhlth hlthpln1
## 1        2      1        1      Fair       30       29       30      Yes
## 2        2      1        1      Good        0        0       NA      Yes
## 3        3      2        1      Good        3        2        0      Yes
## 4        2      1        1 Very good        2        0        0      Yes
## 5        2      1        1      Good       10        2        0      Yes
## 6        1      0        1 Very good        0        0       NA      Yes
##        persdoc2 medcost            checkup1 sleptim1 bphigh4 bpmeds bloodcho
## 1 Yes, only one      No    Within past year       NA     Yes    Yes      Yes
## 2 Yes, only one      No    Within past year        6      No   <NA>      Yes
## 3 Yes, only one      No    Within past year        9      No   <NA>      Yes
## 4 Yes, only one      No Within past 2 years        8      No   <NA>      Yes
## 5 Yes, only one      No 5 or more years ago        6     Yes     No      Yes
## 6 Yes, only one      No    Within past year        8     Yes    Yes      Yes
##               cholchk toldhi2 cvdinfr4 cvdcrhd4 cvdstrk3 asthma3 asthnow
## 1    Within past year     Yes       No     <NA>       No     Yes     Yes
## 2    Within past year      No       No       No       No      No    <NA>
## 3 5 or more years ago      No       No       No       No      No    <NA>
## 4    Within past year     Yes       No       No       No      No    <NA>
## 5 Within past 2 years      No       No       No       No     Yes      No
## 6    Within past year     Yes       No       No       No      No    <NA>
##   chcscncr chcocncr chccopd1 havarth3 addepev2 chckidny diabete3 veteran3
## 1       No       No      Yes      Yes      Yes      Yes       No       No
## 2       No       No       No       No      Yes       No       No       No
## 3       No       No       No      Yes      Yes       No       No       No
## 4       No       No       No       No       No       No       No       No
## 5       No      Yes       No       No       No       No       No       No
## 6       No       No       No       No       No       No       No       No
##    marital children
## 1 Divorced        0
## 2  Married        2
## 3  Married        0
## 4  Married        0
## 5  Married        0
## 6 Divorced        0
##                                                          educa
## 1                   College 4 years or more (College graduate)
## 2 College 1 year to 3 years (Some college or technical school)
## 3                   College 4 years or more (College graduate)
## 4                       Grade 12 or GED (High school graduate)
## 5                   College 4 years or more (College graduate)
## 6                   College 4 years or more (College graduate)
##              employ1           income2 weight2 height3 numhhol2
## 1            Retired Less than $75,000     250     507      Yes
## 2 Employed for wages   $75,000 or more     127     510       No
## 3 Employed for wages   $75,000 or more     160     504       No
## 4            Retired Less than $75,000     128     504       No
## 5            Retired Less than $50,000     265     600       No
## 6 Employed for wages   $75,000 or more     225     503      Yes
##                          numphon2 cpdemo1 cpdemo4 internet renthom1    sex
## 1 2 residential telephone numbers     Yes      10      Yes      Own Female
## 2                            <NA>     Yes      70      Yes      Own Female
## 3                            <NA>     Yes      70      Yes      Own Female
## 4                            <NA>     Yes      75      Yes      Own Female
## 5                            <NA>     Yes       0      Yes      Own   Male
## 6  1 residential telephone number     Yes      70      Yes      Own Female
##   pregnant qlactlm2 useequip blind decide diffwalk diffdres diffalon smoke100
## 1     <NA>      Yes      Yes    No     No      Yes       No      Yes      Yes
## 2     <NA>       No       No    No     No       No       No       No       No
## 3     <NA>      Yes       No    No     No      Yes       No       No      Yes
## 4     <NA>       No       No    No     No       No       No       No       No
## 5     <NA>       No       No    No     No       No       No       No      Yes
## 6     <NA>       No       No    No     No       No       No       No       No
##     smokday2 stopsmk2              lastsmk2    usenow3 alcday5 avedrnk2
## 1 Not at all     <NA>      10 years or more Not at all     201        2
## 2       <NA>     <NA>                  <NA> Not at all       0       NA
## 3  Some days      Yes                  <NA> Not at all     220        4
## 4       <NA>     <NA>                  <NA> Not at all     208        2
## 5 Not at all     <NA> Within the past month Not at all     210        2
## 6       <NA>     <NA>                  <NA> Not at all       0       NA
##   drnk3ge5 maxdrnks fruitju1 fruit1 fvbeans fvgreen fvorang vegetab1 exerany2
## 1        0        2      304    104     303     310     303       NA       No
## 2       NA       NA      305    301     310     203     202      203      Yes
## 3       20       10      301    203     202     202     310      330       No
## 4        0        2      202    306     202     310     305      204      Yes
## 5        0        3        0    302     101     310     303      101       No
## 6       NA       NA      205    206       0     203       0      207      Yes
##                     exract11 exeroft1 exerhmm1
## 1                       <NA>       NA       NA
## 2                    Walking      105       20
## 3                       <NA>       NA       NA
## 4                    Walking      205       30
## 5                       <NA>       NA       NA
## 6 Bicycling machine exercise      102       15
##                                                       exract21 exeroft2
## 1                                                         <NA>       NA
## 2 Household Activities (vacuuming, dusting, home repair, etc.)      101
## 3                                                         <NA>       NA
## 4                                            No other activity       NA
## 5                                                         <NA>       NA
## 6               Gardening (spading, weeding, digging, filling)      102
##   exerhmm2 strength lmtjoin3 arthdis2 arthsocl joinpain seatbelt flushot6
## 1       NA        0      Yes      Yes    A lot        7   Always       No
## 2       10        0     <NA>     <NA>     <NA>       NA   Always      Yes
## 3       NA        0      Yes      Yes A little        5   Always      Yes
## 4       NA        0     <NA>     <NA>     <NA>       NA   Always       No
## 5       NA        0     <NA>     <NA>     <NA>       NA   Always       No
## 6       30        0     <NA>     <NA>     <NA>       NA   Always      Yes
##       flshtmy2                                    tetanus pneuvac3 hivtst6
## 1         <NA> No, did not receive any tetanus since 2005      Yes      No
## 2 October 2012                         Yes, received Tdap       No     Yes
## 3 January 2013                         Yes, received Tdap       No     Yes
## 4         <NA> No, did not receive any tetanus since 2005       No      No
## 5         <NA> No, did not receive any tetanus since 2005       No      No
## 6         <NA> No, did not receive any tetanus since 2005      Yes     Yes
##   hivtstd3              whrtst10 pdiabtst prediab1 diabage2 insulin bldsugar
## 1       NA                  <NA>      Yes      Yes             <NA>       NA
## 2       NA Private doctor or HMO      Yes       No             <NA>       NA
## 3       NA               At home      Yes       No             <NA>       NA
## 4       NA                  <NA>      Yes       No             <NA>       NA
## 5       NA                  <NA>       No       No             <NA>       NA
## 6       NA        Somewhere else      Yes       No             <NA>       NA
##   feetchk2 doctdiab chkhemo3 feetchk eyeexam diabeye diabedu painact2 qlmentl2
## 1       NA                NA      NA    <NA>    <NA>    <NA>        5       30
## 2       NA                NA      NA    <NA>    <NA>    <NA>        0        2
## 3       NA                NA      NA    <NA>    <NA>    <NA>       20        2
## 4       NA                NA      NA    <NA>    <NA>    <NA>        0        6
## 5       NA                NA      NA    <NA>    <NA>    <NA>       NA       NA
## 6       NA                NA      NA    <NA>    <NA>    <NA>       NA       NA
##   qlstres2 qlhlth2 medicare hlthcvrg                                 delaymed
## 1       30       0      Yes      3 7           You didn't have transportation
## 2        3      25       No        2 No, I did not delay getting medical care
## 3        5       2       No        3                                     <NA>
## 4        4      20       No        3 No, I did not delay getting medical care
## 5       NA      NA      Yes      4 2 No, I did not delay getting medical care
## 6       NA      NA       No        1                                    Other
##           dlyother nocov121 lstcovrg drvisits medscost           carercvd
## 1                        No     <NA>        5       No     Very satisfied
## 2                        No     <NA>        3       No     Very satisfied
## 3                        No     <NA>        6       No     Very satisfied
## 4                        No     <NA>        1       No Somewhat satisfied
## 5                        No     <NA>        2       No     Very satisfied
## 6 don t like going       No     <NA>        4       No     Very satisfied
##   medbills ssbsugar ssbfrut2 wtchsalt longwtch dradvise asthmage asattack
## 1       No      305      305      Yes      408      Yes       56      Yes
## 2       No      203        0       No       NA       No       NA     <NA>
## 3       No      202      308       No       NA       No       NA     <NA>
## 4       No      203      315      Yes      405       No       NA     <NA>
## 5       No       NA       NA     <NA>       NA     <NA>       NA     <NA>
## 6       No       NA       NA     <NA>       NA     <NA>       NA     <NA>
##   aservist asdrvist asrchkup asactlim                        asymptom asnoslep
## 1        0        0        3       NA Every day, but not all the time     None
## 2       NA       NA       NA       NA                            <NA>     <NA>
## 3       NA       NA       NA       NA                            <NA>     <NA>
## 4       NA       NA       NA       NA                            <NA>     <NA>
## 5       NA       NA       NA       NA                            <NA>     <NA>
## 6       NA       NA       NA       NA                            <NA>     <NA>
##       asthmed3      asinhalr harehab1 strehab1 cvdasprn              aspunsaf
## 1 1 to 14 days 5 to 14 times     <NA>     <NA>       No Yes, stomach problems
## 2         <NA>          <NA>     <NA>     <NA>       No                    No
## 3         <NA>          <NA>     <NA>     <NA>       No                    No
## 4         <NA>          <NA>     <NA>     <NA>       No                    No
## 5         <NA>          <NA>     <NA>     <NA>     <NA>                  <NA>
## 6         <NA>          <NA>     <NA>     <NA>     <NA>                  <NA>
##   rlivpain rduchart rducstrk                                arttoday arthwgt
## 1     <NA>     <NA>     <NA> I can do some things I would like to do     Yes
## 2     <NA>     <NA>     <NA>                                    <NA>    <NA>
## 3     <NA>     <NA>     <NA> I can do some things I would like to do      No
## 4     <NA>     <NA>     <NA>                                    <NA>    <NA>
## 5     <NA>     <NA>     <NA>                                    <NA>    <NA>
## 6     <NA>     <NA>     <NA>                                    <NA>    <NA>
##   arthexer arthedu                                                   imfvplac
## 1      Yes      No                                                       <NA>
## 2     <NA>    <NA>                                                  Workplace
## 3      Yes      No A doctor´s office or health maintenance organization (HMO)
## 4     <NA>    <NA>                                                       <NA>
## 5     <NA>    <NA>                                                       <NA>
## 6     <NA>    <NA>                                                       <NA>
##   hpvadvc2 hpvadsht hadmam             howlong profexam            lengexam
## 1     <NA>     <NA>    Yes Within past 2 years      Yes Within past 2 years
## 2     <NA>     <NA>    Yes Within past 3 years      Yes Within past 3 years
## 3     <NA>     <NA>    Yes    Within past year      Yes    Within past year
## 4     <NA>     <NA>    Yes    Within past year      Yes Within past 2 years
## 5     <NA>     <NA>   <NA>                <NA>     <NA>                <NA>
## 6     <NA>     <NA>   <NA>                <NA>     <NA>                <NA>
##   hadpap2            lastpap2 hadhyst2 bldstool            lstblds3 hadsigm3
## 1     Yes 5 or more years ago      Yes       No                <NA>      Yes
## 2     Yes Within past 3 years       No       No                <NA>       No
## 3     Yes    Within past year      Yes      Yes 5 or more years ago      Yes
## 4     Yes Within past 2 years       No      Yes 5 or more years ago      Yes
## 5    <NA>                <NA>     <NA>       No                <NA>      Yes
## 6    <NA>                <NA>     <NA>     <NA>                <NA>     <NA>
##      hadsgco1            lastsig3 pcpsaad2 pcpsadi1 pcpsare1 psatest1 psatime
## 1 Colonoscopy Within past 2 years     <NA>     <NA>     <NA>     <NA>    <NA>
## 2        <NA>                <NA>     <NA>     <NA>     <NA>     <NA>    <NA>
## 3 Colonoscopy Within past 3 years     <NA>     <NA>     <NA>     <NA>    <NA>
## 4 Colonoscopy Within past 5 years     <NA>     <NA>     <NA>     <NA>    <NA>
## 5 Colonoscopy Within past 2 years     <NA>     <NA>     <NA>     <NA>    <NA>
## 6        <NA>                <NA>     <NA>     <NA>     <NA>     <NA>    <NA>
##   pcpsars1 pcpsade1 pcdmdecn                  rrclass2 rrcognt2
## 1     <NA>     <NA>       NA Black or African American    Never
## 2     <NA>     <NA>       NA                     White    Never
## 3     <NA>     <NA>       NA                     White    Never
## 4     <NA>     <NA>       NA                     White     <NA>
## 5     <NA>     <NA>       NA                      <NA>     <NA>
## 6     <NA>     <NA>       NA                      <NA>     <NA>
##                  rratwrk2                rrhcare3 rrphysm2 rremtsm2 misnervs
## 1                    <NA> The same as other races       No       No     Some
## 2 The same as other races The same as other races       No       No A little
## 3 The same as other races The same as other races       No       No     None
## 4                    <NA> The same as other races       No       No A little
## 5                    <NA>                    <NA>     <NA>     <NA>     <NA>
## 6                    <NA>                    <NA>     <NA>     <NA>     <NA>
##   mishopls misrstls misdeprd miseffrt miswtles misnowrk mistmnt       mistrhlp
## 1     Some     Some     None      All     None       30     Yes Agree strongly
## 2     None     None     None     None     None        0      No Agree slightly
## 3     None     None     None     None     None        0      No Agree strongly
## 4     None     Some     None     None     None        0      No Agree strongly
## 5     <NA>     <NA>     <NA>     <NA>     <NA>       NA    <NA>           <NA>
## 6     <NA>     <NA>     <NA>     <NA>     <NA>       NA    <NA>           <NA>
##            misphlpf scntmony scntmeal         scntpaid scntwrk1
## 1 Disagree slightly    Never    Never             <NA>       NA
## 2 Disagree slightly    Never    Never Paid by the hour       35
## 3    Agree strongly    Never    Never Paid by the hour       40
## 4 Disagree slightly    Never    Never             <NA>       NA
## 5              <NA>    Never    Never             <NA>       NA
## 6              <NA>    Never    Never   Paid by salary       40
##                 scntlpad scntlwk1 scntvot1 rcsgendr rcsrltn2 casthdx2 casthno2
## 1         Paid by salary       NA      Yes     <NA>     <NA>     <NA>     <NA>
## 2                   <NA>       NA      Yes     Girl   Parent       No     <NA>
## 3                   <NA>       NA      Yes     <NA>     <NA>     <NA>     <NA>
## 4         Paid by salary       60      Yes     <NA>     <NA>     <NA>     <NA>
## 5 Paid by the job / task       60      Yes     <NA>     <NA>     <NA>     <NA>
## 6                   <NA>       NA      Yes     <NA>     <NA>     <NA>     <NA>
##    emtsuprt       lsatisfy ctelnum1 cellfon2 cadult pvtresd2 cclghous cstate
## 1    Always Very satisfied     <NA>     <NA>   <NA>     <NA>     <NA>   <NA>
## 2 Sometimes      Satisfied     <NA>     <NA>   <NA>     <NA>     <NA>   <NA>
## 3   Usually Very satisfied     <NA>     <NA>   <NA>     <NA>     <NA>   <NA>
## 4   Usually Very satisfied     <NA>     <NA>   <NA>     <NA>     <NA>   <NA>
## 5      <NA>           <NA>     <NA>     <NA>   <NA>     <NA>     <NA>   <NA>
## 6      <NA>           <NA>     <NA>     <NA>   <NA>     <NA>     <NA>   <NA>
##   landline pctcell                qstver qstlang
## 1     <NA>      NA Only Version Landline English
## 2     <NA>      NA Only Version Landline English
## 3     <NA>      NA Only Version Landline English
## 4     <NA>      NA Only Version Landline English
## 5     <NA>      NA Only Version Landline English
## 6     <NA>      NA Only Version Landline English
##                                mscode X_ststr  X_strwt X_rawrake X_wt2rake
## 1 Inside a suburban county of the MSA   11081 40.19767         1  40.19767
## 2 Inside a suburban county of the MSA   11081 40.19767         2  80.39535
## 3 Inside a suburban county of the MSA   11081 40.19767         3 120.59302
## 4 Inside a suburban county of the MSA   11081 40.19767         2  80.39535
## 5 Inside a suburban county of the MSA   11082 60.31918         2 120.63837
## 6 Inside a suburban county of the MSA   11081 40.19767         1  40.19767
##             X_imprace X_impnph X_impeduc X_impmrtl X_imphome
## 1 Black, Non-Hispanic        2        NA        NA        NA
## 2 White, Non-Hispanic        1        NA        NA        NA
## 3 White, Non-Hispanic        1        NA        NA        NA
## 4 White, Non-Hispanic        1        NA        NA        NA
## 5 White, Non-Hispanic        1        NA        NA        NA
## 6 Black, Non-Hispanic        1        NA        NA        NA
##                                            X_chispnc X_crace1       X_impcage
## 1                                               <NA>     <NA>            <NA>
## 2 Child not of Hispanic, Latino/a, or Spanish origin    White 10-14 Years old
## 3                                               <NA>     <NA>            <NA>
## 4                                               <NA>     <NA>            <NA>
## 5                                               <NA>     <NA>            <NA>
## 6                                               <NA>     <NA>            <NA>
##             X_impcrac X_impcsex X_cllcpwt         X_dualuse X_dualcor X_llcpwt2
## 1                <NA>      <NA>        NA No Dual Phone Use        NA  331.4934
## 2 White, non-Hispanic    Female  954.0782 No Dual Phone Use        NA  662.9867
## 3                <NA>      <NA>        NA No Dual Phone Use        NA  994.4801
## 4                <NA>      <NA>        NA No Dual Phone Use        NA  662.9867
## 5                <NA>      <NA>        NA No Dual Phone Use        NA  994.8540
## 6                <NA>      <NA>        NA No Dual Phone Use        NA  331.4934
##   X_llcpwt              X_rfhlth                 X_hcvu651 X_rfhype5
## 1 238.0161   Fair or Poor Health Have health care coverage       Yes
## 2 737.6942 Good or Better Health Have health care coverage        No
## 3 568.5274 Good or Better Health Have health care coverage        No
## 4 606.9764 Good or Better Health Have health care coverage        No
## 5 629.8471 Good or Better Health                      <NA>       Yes
## 6 272.2382 Good or Better Health Have health care coverage       Yes
##                                          X_cholchk X_rfchol X_ltasth1 X_casthm1
## 1          Had cholesterol checked in past 5 years      Yes       Yes       Yes
## 2          Had cholesterol checked in past 5 years       No        No        No
## 3 Did not have cholesterol checked in past 5 years       No        No        No
## 4          Had cholesterol checked in past 5 years      Yes        No        No
## 5          Had cholesterol checked in past 5 years       No       Yes        No
## 6          Had cholesterol checked in past 5 years      Yes        No        No
##   X_asthms1                    X_drdxar1                  X_prace1
## 1   Current     Diagnosed with arthritis Black or African American
## 2     Never Not diagnosed with arthritis                     White
## 3     Never     Diagnosed with arthritis                     White
## 4     Never Not diagnosed with arthritis                     White
## 5    Former Not diagnosed with arthritis                     White
## 6     Never Not diagnosed with arthritis Black or African American
##                    X_mrace1                                    X_hispanc
## 1 Black or African American Not of Hispanic, Latino/a, or Spanish origin
## 2                     White Not of Hispanic, Latino/a, or Spanish origin
## 3                     White Not of Hispanic, Latino/a, or Spanish origin
## 4                     White Not of Hispanic, Latino/a, or Spanish origin
## 5                     White Not of Hispanic, Latino/a, or Spanish origin
## 6 Black or African American Not of Hispanic, Latino/a, or Spanish origin
##                     X_race             X_raceg21                X_racegr3
## 1 Black only, non-Hispanic Non-White or Hispanic Black only, Non-Hispanic
## 2 White only, non-Hispanic    Non-Hispanic White White only, Non-Hispanic
## 3 White only, non-Hispanic    Non-Hispanic White White only, Non-Hispanic
## 4 White only, non-Hispanic    Non-Hispanic White White only, Non-Hispanic
## 5 White only, non-Hispanic    Non-Hispanic White White only, Non-Hispanic
## 6 Black only, non-Hispanic Non-White or Hispanic Black only, Non-Hispanic
##              X_race_g1    X_ageg5yr       X_age65yr         X_age_g htin4 htm4
## 1 Black - Non-Hispanic Age 60 to 64    Age 18 to 64    Age 55 to 64    67  170
## 2 White - Non-Hispanic Age 50 to 54    Age 18 to 64    Age 45 to 54    70  178
## 3 White - Non-Hispanic Age 55 to 59    Age 18 to 64    Age 55 to 64    64  163
## 4 White - Non-Hispanic Age 60 to 64    Age 18 to 64    Age 55 to 64    64  163
## 5 White - Non-Hispanic Age 65 to 69 Age 65 or older Age 65 or older    72  183
## 6 Black - Non-Hispanic Age 45 to 49    Age 18 to 64    Age 45 to 54    63  160
##   wtkg3 X_bmi5     X_bmi5cat X_rfbmi5                 X_chldcnt
## 1 11340   3916         Obese      Yes  No children in household
## 2  5761   1822   Underweight       No Two children in household
## 3  7257   2746    Overweight      Yes  No children in household
## 4  5806   2197 Normal weight       No  No children in household
## 5 12020   3594         Obese      Yes  No children in household
## 6 10206   3986         Obese      Yes  No children in household
##                                     X_educag                     X_incomg
## 1 Graduated from college or technical school              $50,000 or more
## 2       Attended college or technical school              $50,000 or more
## 3 Graduated from college or technical school              $50,000 or more
## 4                      Graduated high school              $50,000 or more
## 5 Graduated from college or technical school $35,000 to less than $50,000
## 6 Graduated from college or technical school              $50,000 or more
##                               X_smoker3 X_rfsmok3 drnkany5 drocdy3_ X_rfbing5
## 1                         Former smoker        No       No        3        No
## 2                          Never smoked        No      Yes        0        No
## 3 Current smoker - now smokes some days       Yes       No       67       Yes
## 4                          Never smoked        No       No       27        No
## 5                         Former smoker        No       No       33        No
## 6                          Never smoked        No      Yes        0        No
##   X_drnkdy4 X_drnkmo4 X_rfdrhv4 X_rfdrmn4 X_rfdrwm4 ftjuda1_ frutda1_ beanday_
## 1         7         2        No      <NA>        No       13      400       10
## 2         0         0        No      <NA>        No       17        3       33
## 3       267        80       Yes      <NA>       Yes        3       43       29
## 4        53        16        No      <NA>        No       29       20       29
## 5        67        20        No        No      <NA>        0        7      100
## 6         0         0        No      <NA>        No       71       86        0
##   grenday_ orngday_ vegeda1_                  X_misfrtn
## 1       33       10       NA No missing fruit responses
## 2       43       29       43 No missing fruit responses
## 3       29       33      100 No missing fruit responses
## 4       33       17       57 No missing fruit responses
## 5       33       10      100 No missing fruit responses
## 6       43        0      100 No missing fruit responses
##                        X_misvegn                          X_frtresp
## 1             1 missing response Included - Missing Fruit Responses
## 2 No missing vegetable responses Included - Missing Fruit Responses
## 3 No missing vegetable responses Included - Missing Fruit Responses
## 4 No missing vegetable responses Included - Missing Fruit Responses
## 5 No missing vegetable responses Included - Missing Fruit Responses
## 6 No missing vegetable responses Included - Missing Fruit Responses
##                                X_vegresp X_frutsum X_vegesum
## 1 Not Included - Missing Fruit Responses       413        53
## 2     Included - Missing Fruit Responses        20       148
## 3     Included - Missing Fruit Responses        46       191
## 4     Included - Missing Fruit Responses        49       136
## 5     Included - Missing Fruit Responses         7       243
## 6     Included - Missing Fruit Responses       157       143
##                                    X_frtlt1
## 1  Consumed fruit one or more times per day
## 2 Consumed fruit less than one time per day
## 3 Consumed fruit less than one time per day
## 4 Consumed fruit less than one time per day
## 5 Consumed fruit less than one time per day
## 6  Consumed fruit one or more times per day
##                                         X_veglt1
## 1 Consumed vegetables less than one time per day
## 2  Consumed vegetables one or more times per day
## 3  Consumed vegetables one or more times per day
## 4  Consumed vegetables one or more times per day
## 5  Consumed vegetables one or more times per day
## 6  Consumed vegetables one or more times per day
##                                   X_frt16
## 1 Included - values are in accepted range
## 2 Included - values are in accepted range
## 3 Included - values are in accepted range
## 4 Included - values are in accepted range
## 5 Included - values are in accepted range
## 6 Included - values are in accepted range
##                                   X_veg23
## 1 Included - values are in accepted range
## 2 Included - values are in accepted range
## 3 Included - values are in accepted range
## 4 Included - values are in accepted range
## 5 Included - values are in accepted range
## 6 Included - values are in accepted range
##                                 X_fruitex
## 1 No missing values and in accepted range
## 2 No missing values and in accepted range
## 3 No missing values and in accepted range
## 4 No missing values and in accepted range
## 5 No missing values and in accepted range
## 6 No missing values and in accepted range
##                                 X_vegetex
## 1            Missing vegetables responses
## 2 No missing values and in accepted range
## 3 No missing values and in accepted range
## 4 No missing values and in accepted range
## 5 No missing values and in accepted range
## 6 No missing values and in accepted range
##                                          X_totinda metvl11_ metvl21_ maxvo2_
## 1 No physical activity or exercise in last 30 days       NA       NA    2580
## 2                Had physical activity or exercise       35       33    2950
## 3 No physical activity or exercise in last 30 days       NA       NA    2765
## 4                Had physical activity or exercise       35        0    2432
## 5 No physical activity or exercise in last 30 days       NA       NA    2370
## 6                Had physical activity or exercise       68       50    2987
##   fc60_ actin11_                                actin21_ padur1_ padur2_
## 1   442     <NA>                                    <NA>      NA      NA
## 2   506 Moderate                                Moderate      20      10
## 3   474     <NA>                                    <NA>      NA      NA
## 4   417 Moderate Not Moderate or Vigorous or No Activity      30      NA
## 5   406     <NA>                                    <NA>      NA      NA
## 6   512 Vigorous                                Moderate      15      30
##   pafreq1_ pafreq2_ X_minac11 X_minac21 strfreq_ pamiss1_ pamin11_ pamin21_
## 1       NA       NA        NA        NA        0        0       NA       NA
## 2     5000     1000       100        10        0        0      100       10
## 3       NA       NA        NA        NA        0        0       NA       NA
## 4     1167       NA        35         0        0        0       35        0
## 5       NA       NA        NA        NA        0        0       NA       NA
## 6     2000     2000        30        60        0        0       60       60
##   pa1min_ pavig11_ pavig21_ pa1vigm_              X_pacat1
## 1      NA       NA       NA                       Inactive
## 2     110        0        0        0 Insufficiently active
## 3      NA       NA       NA                       Inactive
## 4      35        0        0        0 Insufficiently active
## 5      NA       NA       NA                       Inactive
## 6     120       30        0       30 Insufficiently active
##                              X_paindx1     X_pa150r2     X_pa300r2
## 1 Did not meet aerobic recommendations     0 minutes     0 minutes
## 2 Did not meet aerobic recommendations 1-149 minutes 1-300 minutes
## 3 Did not meet aerobic recommendations     0 minutes     0 minutes
## 4 Did not meet aerobic recommendations 1-149 minutes 1-300 minutes
## 5 Did not meet aerobic recommendations     0 minutes     0 minutes
## 6 Did not meet aerobic recommendations 1-149 minutes 1-300 minutes
##       X_pa30021                                         X_pastrng
## 1 0-300 minutes Did not meet muscle strengthening recommendations
## 2 0-300 minutes Did not meet muscle strengthening recommendations
## 3 0-300 minutes Did not meet muscle strengthening recommendations
## 4 0-300 minutes Did not meet muscle strengthening recommendations
## 5 0-300 minutes Did not meet muscle strengthening recommendations
## 6 0-300 minutes Did not meet muscle strengthening recommendations
##                        X_parec1                    X_pastae1
## 1 Did not meet either guideline Did not meet both guidelines
## 2 Did not meet either guideline Did not meet both guidelines
## 3 Did not meet either guideline Did not meet both guidelines
## 4 Did not meet either guideline Did not meet both guidelines
## 5 Did not meet either guideline Did not meet both guidelines
## 6 Did not meet either guideline Did not meet both guidelines
##                                               X_lmtact1
## 1 Told have arthritis and have limited usual activities
## 2                          Not told they have arthritis
## 3 Told have arthritis and have limited usual activities
## 4                          Not told they have arthritis
## 5                          Not told they have arthritis
## 6                          Not told they have arthritis
##                                   X_lmtwrk1
## 1 Told have arthritis and have limited work
## 2              Not told they have arthritis
## 3 Told have arthritis and have limited work
## 4              Not told they have arthritis
## 5              Not told they have arthritis
## 6              Not told they have arthritis
##                                                    X_lmtscl1
## 1    Told have arthritis and social activities limited a lot
## 2                               Not told they have arthritis
## 3 Told have arthritis and social activities limited a little
## 4                               Not told they have arthritis
## 5                               Not told they have arthritis
## 6                               Not told they have arthritis
##                                X_rfseat2             X_rfseat3 X_flshot6
## 1 Always or almost always wear seat belt Always wear seat belt      <NA>
## 2 Always or almost always wear seat belt Always wear seat belt      <NA>
## 3 Always or almost always wear seat belt Always wear seat belt      <NA>
## 4 Always or almost always wear seat belt Always wear seat belt      <NA>
## 5 Always or almost always wear seat belt Always wear seat belt        No
## 6 Always or almost always wear seat belt Always wear seat belt      <NA>
##   X_pneumo2 X_aidtst3 X_age80
## 1      <NA>        No      60
## 2      <NA>       Yes      50
## 3      <NA>       Yes      55
## 4      <NA>        No      64
## 5        No        No      66
## 6      <NA>       Yes      49
str(brfss2013)
## 'data.frame':    491775 obs. of  330 variables:
##  $ X_state  : Factor w/ 55 levels "0","Alabama",..: 2 2 2 2 2 2 2 2 2 2 ...
##  $ fmonth   : Factor w/ 12 levels "January","February",..: 1 1 1 1 2 3 3 3 4 4 ...
##  $ idate    : int  1092013 1192013 1192013 1112013 2062013 3272013 3222013 3042013 4242013 4242013 ...
##  $ imonth   : Factor w/ 12 levels "January","February",..: 1 1 1 1 2 3 3 3 4 4 ...
##  $ iday     : Factor w/ 31 levels "1","2","3","4",..: 9 19 19 11 6 27 22 4 24 24 ...
##  $ iyear    : Factor w/ 2 levels "2013","2014": 1 1 1 1 1 1 1 1 1 1 ...
##  $ dispcode : Factor w/ 2 levels "Completed interview",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ seqno    : int  2013000580 2013000593 2013000600 2013000606 2013000608 2013000630 2013000634 2013000644 2013001305 2013001338 ...
##  $ X_psu    : int  2013000580 2013000593 2013000600 2013000606 2013000608 2013000630 2013000634 2013000644 2013001305 2013001338 ...
##  $ ctelenum : Factor w/ 1 level "Yes": 1 1 1 1 1 1 1 1 1 1 ...
##  $ pvtresd1 : Factor w/ 2 levels "Yes","No": 1 1 1 1 1 1 1 1 1 1 ...
##  $ colghous : Factor w/ 1 level "Yes": NA NA NA NA NA NA NA NA NA NA ...
##  $ stateres : Factor w/ 1 level "Yes": 1 1 1 1 1 1 1 1 1 1 ...
##  $ cellfon3 : Factor w/ 1 level "Not a cellular phone": 1 1 1 1 1 1 1 1 1 1 ...
##  $ ladult   : Factor w/ 2 levels "Yes, male respondent",..: NA NA NA NA NA NA NA NA NA NA ...
##  $ numadult : Factor w/ 19 levels "1","2","3","4",..: 2 2 3 2 2 1 2 1 5 2 ...
##  $ nummen   : Factor w/ 14 levels "0","1","2","3",..: 2 2 3 2 2 1 2 1 5 2 ...
##  $ numwomen : Factor w/ 12 levels "0","1","2","3",..: 2 2 2 2 2 2 2 2 2 2 ...
##  $ genhlth  : Factor w/ 5 levels "Excellent","Very good",..: 4 3 3 2 3 2 4 3 1 3 ...
##  $ physhlth : int  30 0 3 2 10 0 1 5 0 0 ...
##  $ menthlth : int  29 0 2 0 2 0 15 0 0 0 ...
##  $ poorhlth : int  30 NA 0 0 0 NA 0 10 NA NA ...
##  $ hlthpln1 : Factor w/ 2 levels "Yes","No": 1 1 1 1 1 1 1 1 1 1 ...
##  $ persdoc2 : Factor w/ 3 levels "Yes, only one",..: 1 1 1 1 1 1 2 1 1 1 ...
##  $ medcost  : Factor w/ 2 levels "Yes","No": 2 2 2 2 2 2 2 2 2 2 ...
##  $ checkup1 : Factor w/ 5 levels "Within past year",..: 1 1 1 2 4 1 1 1 1 1 ...
##  $ sleptim1 : int  NA 6 9 8 6 8 7 6 8 8 ...
##  $ bphigh4  : Factor w/ 4 levels "Yes","Yes, but female told only during pregnancy",..: 1 3 3 3 1 1 1 1 3 3 ...
##  $ bpmeds   : Factor w/ 2 levels "Yes","No": 1 NA NA NA 2 1 1 1 NA NA ...
##  $ bloodcho : Factor w/ 2 levels "Yes","No": 1 1 1 1 1 1 1 1 1 1 ...
##  $ cholchk  : Factor w/ 4 levels "Within past year",..: 1 1 4 1 2 1 1 1 1 1 ...
##  $ toldhi2  : Factor w/ 2 levels "Yes","No": 1 2 2 1 2 1 2 1 1 2 ...
##  $ cvdinfr4 : Factor w/ 2 levels "Yes","No": 2 2 2 2 2 2 2 2 2 2 ...
##  $ cvdcrhd4 : Factor w/ 2 levels "Yes","No": NA 2 2 2 2 2 2 1 2 2 ...
##  $ cvdstrk3 : Factor w/ 2 levels "Yes","No": 2 2 2 2 2 2 2 2 2 2 ...
##  $ asthma3  : Factor w/ 2 levels "Yes","No": 1 2 2 2 1 2 2 2 2 2 ...
##  $ asthnow  : Factor w/ 2 levels "Yes","No": 1 NA NA NA 2 NA NA NA NA NA ...
##  $ chcscncr : Factor w/ 2 levels "Yes","No": 2 2 2 2 2 2 2 2 2 2 ...
##  $ chcocncr : Factor w/ 2 levels "Yes","No": 2 2 2 2 1 2 2 2 2 2 ...
##  $ chccopd1 : Factor w/ 2 levels "Yes","No": 1 2 2 2 2 2 2 2 2 2 ...
##  $ havarth3 : Factor w/ 2 levels "Yes","No": 1 2 1 2 2 2 1 1 1 2 ...
##  $ addepev2 : Factor w/ 2 levels "Yes","No": 1 1 1 2 2 2 2 2 2 2 ...
##  $ chckidny : Factor w/ 2 levels "Yes","No": 1 2 2 2 2 2 2 2 2 2 ...
##  $ diabete3 : Factor w/ 4 levels "Yes","Yes, but female told only during pregnancy",..: 3 3 3 3 3 3 3 3 3 3 ...
##  $ veteran3 : Factor w/ 2 levels "Yes","No": 2 2 2 2 2 2 2 2 2 2 ...
##  $ marital  : Factor w/ 6 levels "Married","Divorced",..: 2 1 1 1 1 2 1 3 1 1 ...
##  $ children : int  0 2 0 0 0 0 1 0 1 0 ...
##  $ educa    : Factor w/ 6 levels "Never attended school or only kindergarten",..: 6 5 6 4 6 6 4 5 6 4 ...
##  $ employ1  : Factor w/ 8 levels "Employed for wages",..: 7 1 1 7 7 1 1 7 7 5 ...
##  $ income2  : Factor w/ 8 levels "Less than $10,000",..: 7 8 8 7 6 8 NA 6 8 4 ...
##  $ weight2  : Factor w/ 570 levels "",".b","100",..: 154 30 63 31 169 128 9 1 139 73 ...
##  $ height3  : int  507 510 504 504 600 503 500 505 602 505 ...
##  $ numhhol2 : Factor w/ 2 levels "Yes","No": 1 2 2 2 2 1 2 2 2 2 ...
##  $ numphon2 : Factor w/ 6 levels "1 residential telephone number",..: 2 NA NA NA NA 1 NA NA NA NA ...
##  $ cpdemo1  : Factor w/ 2 levels "Yes","No": 1 1 1 1 1 1 1 1 1 1 ...
##  $ cpdemo4  : int  10 70 70 75 0 70 40 1 60 50 ...
##  $ internet : Factor w/ 2 levels "Yes","No": 1 1 1 1 1 1 1 1 1 1 ...
##  $ renthom1 : Factor w/ 3 levels "Own","Rent","Other arrangement": 1 1 1 1 1 1 1 2 1 1 ...
##  $ sex      : Factor w/ 2 levels "Male","Female": 2 2 2 2 1 2 2 2 1 2 ...
##  $ pregnant : Factor w/ 2 levels "Yes","No": NA NA NA NA NA NA 2 NA NA NA ...
##  $ qlactlm2 : Factor w/ 2 levels "Yes","No": 1 2 1 2 2 2 1 1 2 2 ...
##  $ useequip : Factor w/ 2 levels "Yes","No": 1 2 2 2 2 2 2 2 2 2 ...
##  $ blind    : Factor w/ 2 levels "Yes","No": 2 2 2 2 2 2 2 2 2 2 ...
##  $ decide   : Factor w/ 2 levels "Yes","No": 2 2 2 2 2 2 2 2 2 2 ...
##  $ diffwalk : Factor w/ 2 levels "Yes","No": 1 2 1 2 2 2 2 1 2 2 ...
##  $ diffdres : Factor w/ 2 levels "Yes","No": 2 2 2 2 2 2 2 2 2 2 ...
##  $ diffalon : Factor w/ 2 levels "Yes","No": 1 2 2 2 2 2 2 2 2 2 ...
##  $ smoke100 : Factor w/ 2 levels "Yes","No": 1 2 1 2 1 2 1 1 2 2 ...
##  $ smokday2 : Factor w/ 3 levels "Every day","Some days",..: 3 NA 2 NA 3 NA 3 1 NA NA ...
##  $ stopsmk2 : Factor w/ 2 levels "Yes","No": NA NA 1 NA NA NA NA 2 NA NA ...
##  $ lastsmk2 : Factor w/ 8 levels "Within the past month",..: 7 NA NA NA 1 NA 5 NA NA NA ...
##  $ usenow3  : Factor w/ 3 levels "Every day","Some days",..: 3 3 3 3 3 3 3 3 1 3 ...
##  $ alcday5  : int  201 0 220 208 210 0 201 202 101 0 ...
##  $ avedrnk2 : int  2 NA 4 2 2 NA 1 1 1 NA ...
##  $ drnk3ge5 : int  0 NA 20 0 0 NA 0 0 0 NA ...
##  $ maxdrnks : int  2 NA 10 2 3 NA 1 1 2 NA ...
##  $ fruitju1 : int  304 305 301 202 0 205 320 0 0 202 ...
##  $ fruit1   : int  104 301 203 306 302 206 325 320 101 202 ...
##  $ fvbeans  : int  303 310 202 202 101 0 330 360 202 203 ...
##  $ fvgreen  : int  310 203 202 310 310 203 315 315 203 201 ...
##  $ fvorang  : int  303 202 310 305 303 0 310 325 0 201 ...
##  $ vegetab1 : int  NA 203 330 204 101 207 310 308 101 203 ...
##  $ exerany2 : Factor w/ 2 levels "Yes","No": 2 1 2 1 2 1 1 1 1 1 ...
##  $ exract11 : Factor w/ 75 levels "Active Gaming Devices (Wii Fit, Dance, Dance revolution)",..: NA 64 NA 64 NA 6 64 64 7 64 ...
##  $ exeroft1 : int  NA 105 NA 205 NA 102 220 102 102 220 ...
##  $ exerhmm1 : int  NA 20 NA 30 NA 15 100 15 100 30 ...
##  $ exract21 : Factor w/ 76 levels "Active Gaming Devices (Wii Fit, Dance, Dance revolution)",..: NA 71 NA 75 NA 18 75 75 75 18 ...
##  $ exeroft2 : int  NA 101 NA NA NA 102 NA NA NA 101 ...
##  $ exerhmm2 : int  NA 10 NA NA NA 30 NA NA NA 100 ...
##  $ strength : int  0 0 0 0 0 0 205 0 102 0 ...
##  $ lmtjoin3 : Factor w/ 2 levels "Yes","No": 1 NA 1 NA NA NA 2 1 2 NA ...
##  $ arthdis2 : Factor w/ 2 levels "Yes","No": 1 NA 1 NA NA NA 1 2 2 NA ...
##  $ arthsocl : Factor w/ 3 levels "A lot","A little",..: 1 NA 2 NA NA NA 3 1 3 NA ...
##  $ joinpain : int  7 NA 5 NA NA NA 3 8 4 NA ...
##  $ seatbelt : Factor w/ 6 levels "Always","Nearly always",..: 1 1 1 1 1 1 1 1 2 1 ...
##  $ flushot6 : Factor w/ 2 levels "Yes","No": 2 1 1 2 2 1 2 1 1 2 ...
##  $ flshtmy2 : Factor w/ 26 levels "January 2012",..: NA 10 13 NA NA NA NA 10 10 NA ...
##  $ tetanus  : Factor w/ 4 levels "Yes, received Tdap",..: 4 1 1 4 4 4 4 4 1 4 ...
##  $ pneuvac3 : Factor w/ 2 levels "Yes","No": 1 2 2 2 2 1 2 2 2 2 ...
##   [list output truncated]

Part 1: Data

The Behavioral Risk Factor Surveillance System (BRFSS) - 2013 data are collected using landline (telephone, i.e., household) and cellular (cellphone, i.e., one adult). The data can be analyzed implementing stratified sampling and cluster sampling.

The stratified sampling helps to consider an causality outcome if the stratum is very similar. In this case, we can take one of the data collection methods and draw samples to form stratum, which can lead to more accurate estimate within the group.

The cluster sampling puts a population into groups which can be separated with a fixed number of draws. This method aids in diverse groups and it can be used to infernce generalizability of the population.

Reference: The BRFSS data user guide June 2013 * * *

Part 2: Research questions

Research quesion 1: What is the average number of adults (i.e., 18 years of age or older) that sleeps more or equal to 7 hours and also have above good general health? Research quesion 2: How many of the interviewed adults complete the survey? Research quesion 3: How does smoking and general exercise influence the general healthe of adults?


Part 3: Exploratory data analysis

Research question Q1: What is the average number of adults (i.e., 18 years of age or older) that sleeps more or equal to 7 hours and also have above good general health?

Answer to Q1 The data summary demonstrated that adults who sleep on average 7.19 hours reported having an excellent general health. It seems that adequate sleep time can influence general well-being. From the analysis below, It was observed that as the number of sleep time hours decrease, adults reported having a fair and poor 6.90 and 6.74, respectively.

Also, the bar chart showed that distribution of the states in the United States where Florida has the highest adults sleeping greater or equal to 7 hours and reporting above fair general health.

These two analysis can help to generalize that adults who might be sleeping the recommended number of sleep hours also are following other health beneficial activities that influence their general health. However, It is important to point out that Florida has a large retired population that may be contributing to its large number of adults.

slptime <- brfss2013 %>% 
      group_by(genhlth) %>% 
      summarize(avg_spltm = mean(sleptim1, na.rm=TRUE), cnt=n())
slptime
## # A tibble: 6 × 3
##   genhlth   avg_spltm    cnt
##   <fct>         <dbl>  <int>
## 1 Excellent      7.19  85482
## 2 Very good      7.10 159076
## 3 Good           7.04 150555
## 4 Fair           6.90  66726
## 5 Poor           6.74  27951
## 6 <NA>           7.47   1985
slptime1 <- brfss2013 %>% 
      group_by(genhlth, X_state) %>% 
      summarize(avg_spltm = mean(sleptim1, na.rm=TRUE), cnt=n()) %>% 
      filter(cnt > 5000)
## `summarise()` has grouped output by 'genhlth'. You can override using the `.groups` argument.
ggplot(data = slptime1, mapping = aes(x=factor(X_state), y=cnt))+
      geom_bar(stat = "identity")+
      labs(title = "States with above fair general health", subtitle = "Average sleep time count vs general health", caption = "data collected by BRFSS")+
      ylab("Number of adults (sleep time)")+
      xlab("State")

Research question Q2: How many of the interviewed adults complete the survey?

Answer to Q2 The analysis showed that on average there are similar number of adults who completed the survey to that who do not complete it. This finding points out that the data collected in the survey need to consider the possibility of large percent information to be either missing or incorrect.

survey <- brfss2013 %>% 
      select(idate, dispcode) %>% 
      drop_na() %>% 
      summarise(avg=mean(idate),
                std=sd(idate),
                mdian=median(idate))
head(survey)
##       avg     std   mdian
## 1 6672294 3412139 7022013
survey <- brfss2013 %>% 
      select(idate, dispcode) %>% 
      drop_na()
ggplot(survey, aes(x=factor(dispcode), y=idate))+
      geom_boxplot()+
      labs(title = "Interviewed vs. Disposition", subtitle = "Interviews adults completing the survey", caption = "data collected by BRFSS2013")+
      xlab("Final Disposition")+
      ylab("# of interviewed")

Research question 3: How does smoking and general exercise influence the general health of adults?

Answer Q3 The analysis inllustrated that adults who stop smoking within the last 12 months and engaged in some form of exercise also shows good general health overall.

activity <- brfss2013 %>% 
      select(stopsmk2,exerany2, genhlth) %>% 
      drop_na() %>%
      group_by(genhlth)
      
head(activity)
## # A tibble: 6 × 3
## # Groups:   genhlth [3]
##   stopsmk2 exerany2 genhlth  
##   <fct>    <fct>    <fct>    
## 1 Yes      No       Good     
## 2 No       Yes      Good     
## 3 Yes      No       Fair     
## 4 Yes      Yes      Good     
## 5 No       Yes      Very good
## 6 No       No       Very good
activity <- brfss2013 %>% 
      select(stopsmk2,exerany2, genhlth) %>% 
      drop_na()
ggplot(activity, aes(stopsmk2, fill=exerany2))+
      geom_bar(position = "dodge")

activity <- brfss2013 %>% 
      select(stopsmk2,exerany2, genhlth) %>% 
      drop_na()
ggplot(activity, aes(genhlth, fill=stopsmk2))+
      geom_bar(position = "dodge")