Deborah Passey
August 11, 2019
This Shiny App displays the most recent data on American's health insurance status.
library(readr)
insurance <- read_csv("DATA.CSV")
library(shiny)
library(ggplot2)
ui <- fluidPage(
titlePanel("US Health Insurance Coverage of Nonelderly (0-64 years), 2017"),
sidebarLayout(
sidebarPanel(helpText("Create custom insruance coverage tables with
information from the Census Bureau's American Community Survey (ACS)
by the Kaiser Family Foundation. ACS includes a 1% sample of
the US population and allows for precise state-level estimates. The numbers provided
are the percentage of nonelderly that fall into each category."),
conditionalPanel(
'input.dataset === "insurance"',
checkboxGroupInput("show_vars", "Variables to show:",
names(insurance), selected = names(insurance))
)),
mainPanel(
tabsetPanel(
id = 'dataset',
tabPanel("insurance", DT::dataTableOutput("mytable1")), p("Employer: Includes those covered by employer-sponsored coverage either through their own job or as a dependent in the same household.
Other Public: Includes those covered under the military or Veterans Administration as well as nonelderly Medicare enrollees.
Non-Group: Includes individuals and families that purchased or are covered as a dependent by non-group insurance.
Uninsured: Includes those without health insurance and those who have coverage under the Indian Health Service only.")
)
)
)
)
library(readr)
insurance <- read_csv("DATA.CSV")
server <- function(input, output) {
# choose columns to display
insurance2 = insurance[sample(nrow(insurance), 51), ]
output$mytable1 <- DT::renderDataTable({
DT::datatable(insurance2[, input$show_vars, drop = FALSE])
})
}
Simply select the variables you want displayed and the number rows you want to show. You can sort by State or by individual variables. It's so easy!
The data for this app is from: The Kaiser Family Foundation - https://www.kff.org/statedata/custom-state-report/