Import the Cheese and Deaths Data
I first imported the deaths and cheese data sets using read_csv.
Cheese Data Set and Variables
I then used the glimpse() command to show the variables in the Cheese data set.
## Rows: 24
## Columns: 9
## $ year <dbl> 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,…
## $ cheddar <dbl> 9.04, 9.19, 9.51, 9.60, 10.01, 9.87, 9.89, 9.76, 9.38, 10.2…
## $ mozzarella <dbl> 7.89, 8.22, 8.16, 8.33, 8.74, 9.05, 9.35, 9.38, 9.45, 9.68,…
## $ swiss <dbl> 1.09, 1.07, 0.99, 1.01, 1.09, 1.02, 1.12, 1.09, 1.13, 1.20,…
## $ blue <dbl> 0.16, 0.17, 0.18, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
## $ brick <dbl> 0.04, 0.04, 0.03, 0.03, 0.03, 0.03, 0.03, 0.03, 0.03, 0.03,…
## $ muenster <dbl> 0.41, 0.39, 0.37, 0.34, 0.28, 0.30, 0.28, 0.28, 0.27, 0.25,…
## $ neufchatel <dbl> 2.04, 2.11, 2.25, 2.20, 2.26, 2.39, 2.21, 2.33, 2.30, 2.34,…
## $ hispanic <dbl> NA, 0.25, 0.25, 0.27, 0.30, 0.33, 0.37, 0.42, 0.45, 0.48, 0…
Deaths Data Set and Variables
I then used the glimpse() command to show the variables in the Deaths data set.
## Rows: 98,280
## Columns: 17
## $ Year <dbl> 2016, 2015, 2014, 2013, 201…
## $ Sex <chr> "Both sexes", "Both sexes",…
## $ `Age group (years)` <chr> "All Ages", "All Ages", "Al…
## $ Race <chr> "All races", "All races", "…
## $ `Injury mechanism` <chr> "All Mechanisms", "All Mech…
## $ `Injury intent` <chr> "All Intentions", "All Inte…
## $ Deaths <dbl> 231991, 214008, 199752, 192…
## $ Population <dbl> 323127513, 321418820, 31885…
## $ `Age Specific Rate` <dbl> 71.795496, 66.582287, 62.64…
## $ `Age Specific Rate Standard Error` <dbl> 0.1490602, 0.1439275, 0.140…
## $ `Age Specific Rate Lower Confidence Limit` <dbl> 71.503338, 66.300189, 62.37…
## $ `Age Specific Rate Upper Confidence Limit` <dbl> 72.087654, 66.864384, 62.92…
## $ `Age Adjusted Rate` <dbl> 68.98224, 63.86611, 60.1272…
## $ `Age Adjusted Rate Standard Error` <dbl> 0.1460097, 0.1405070, 0.136…
## $ `Age Adjusted Rate Lower Confidence Limit` <dbl> 68.69606, 63.59072, 59.8592…
## $ `Age Adjusted Rate Upper Confidence Limit` <dbl> 69.26842, 64.14151, 60.3952…
## $ Unit <chr> "per 100,000 population", "…
Filter and Join data sets
I then filtered and joined the data sets to see only the correlations between Hispanic cheese consumption and types of deaths.
## hispanic Cut/pierce Drowning Fall
## hispanic 1.0000000 0.37086174 0.55441499 0.9610017
## Cut/pierce 0.3708617 1.00000000 0.17063452 0.2206411
## Drowning 0.5544150 0.17063452 1.00000000 0.5567061
## Fall 0.9610017 0.22064112 0.55670608 1.0000000
## Fire/hot object or substance -0.8449676 -0.09090047 -0.53402721 -0.8667681
## Firearm 0.8357115 0.22761514 0.64881514 0.9257407
## Motor vehicle traffic -0.7126225 0.22880203 -0.36438044 -0.7506909
## All Other Transport -0.6559104 -0.31775277 -0.44540194 -0.6067667
## Poisoning 0.9463094 0.30911141 0.63334924 0.9791790
## Suffocation 0.9458343 0.17177657 0.54091944 0.9938990
## All Other Specified -0.4557235 -0.16056723 -0.01576699 -0.4647084
## Unspecified -0.4610547 -0.14550347 0.05042755 -0.3734979
## Fire/hot object or substance Firearm
## hispanic -0.84496765 0.8357115
## Cut/pierce -0.09090047 0.2276151
## Drowning -0.53402721 0.6488151
## Fall -0.86676812 0.9257407
## Fire/hot object or substance 1.00000000 -0.7172177
## Firearm -0.71721766 1.0000000
## Motor vehicle traffic 0.88872560 -0.5418749
## All Other Transport 0.57250666 -0.4904084
## Poisoning -0.78997216 0.9589757
## Suffocation -0.86387501 0.9113808
## All Other Specified 0.52456683 -0.3167888
## Unspecified 0.52310835 -0.1104524
## Motor vehicle traffic All Other Transport
## hispanic -0.7126225 -0.6559104
## Cut/pierce 0.2288020 -0.3177528
## Drowning -0.3643804 -0.4454019
## Fall -0.7506909 -0.6067667
## Fire/hot object or substance 0.8887256 0.5725067
## Firearm -0.5418749 -0.4904084
## Motor vehicle traffic 1.0000000 0.4476599
## All Other Transport 0.4476599 1.0000000
## Poisoning -0.6450346 -0.5999390
## Suffocation -0.7582158 -0.5886872
## All Other Specified 0.4785087 0.3578379
## Unspecified 0.5946724 0.5042059
## Poisoning Suffocation All Other Specified
## hispanic 0.9463094 0.9458343 -0.45572346
## Cut/pierce 0.3091114 0.1717766 -0.16056723
## Drowning 0.6333492 0.5409194 -0.01576699
## Fall 0.9791790 0.9938990 -0.46470837
## Fire/hot object or substance -0.7899722 -0.8638750 0.52456683
## Firearm 0.9589757 0.9113808 -0.31678878
## Motor vehicle traffic -0.6450346 -0.7582158 0.47850867
## All Other Transport -0.5999390 -0.5886872 0.35783788
## Poisoning 1.0000000 0.9654581 -0.40415779
## Suffocation 0.9654581 1.0000000 -0.47571858
## All Other Specified -0.4041578 -0.4757186 1.00000000
## Unspecified -0.2982013 -0.3468012 0.52552447
## Unspecified
## hispanic -0.46105471
## Cut/pierce -0.14550347
## Drowning 0.05042755
## Fall -0.37349794
## Fire/hot object or substance 0.52310835
## Firearm -0.11045238
## Motor vehicle traffic 0.59467240
## All Other Transport 0.50420589
## Poisoning -0.29820134
## Suffocation -0.34680116
## All Other Specified 0.52552447
## Unspecified 1.00000000
Scatter Plot Showing Correlation Between Hispanic Cheese and Fall Deaths.
I chose to plot Hispanic cheese and falls because the correlation coefficient was .96. This can lead people to think there is a strong causal relationship between eating Hispanic cheese and fall deaths.
## `geom_smooth()` using formula = 'y ~ x'