The goal of HealthIneq is to shed light on the health inequities across the United States.
You can install the development version from GitHub with:
# install.packages("devtools")
devtools::install_github("elachtara/HealthIneq")
First you will load the package and call for the data.
library(HealthIneq)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
data("HealthIneq")
Let’s look at the life expectancy for males vs. females:
# Create average life expectancy across all counties
HealthIneq %>%
summarize(male_avg = mean(avglifeM),
female_avg = mean(avglifeF))
#> # A tibble: 1 x 2
#> male_avg female_avg
#> <dbl> <dbl>
#> 1 81.0 84.9
Looks like females live on average over 3 years longer than males.
Let’s make a plot of these life expectancies.
plot(HealthIneq$avglifeM, HealthIneq$avglifeF, main = "Male vs. Female Life Expectancies",
xlab = "Male Life Expectancy (Years)", ylab = "Feale Life Expectancy (Years)")
There appears
to be a linear relationship between male and female life expectancies
across the counties of the United States. Check out the vignette for
more examples on how to use the package.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.