Map assets using coordinate data (latitude, longitude)
Single barplot here to visualize the % Housing Cost burden in each county, color coded by MSA type.
https://rstudio.github.io/dygraphs/
Automatically plots xts time series objects (or any object convertible to xts).
Highly configurable axis and series display (including optional second Y-axis).
Rich interactive features including zoom/pan and series/point highlighting.
Display upper/lower bars (e.g. prediction intervals) around series.
Various graph overlays including shaded regions, event lines, and point annotations.
Another static figure showing infant mortality by life expectancy for each county.
This is a figure that can be made interactive as well without too much hassle, if for isntance you wanted to hover over the dots for additional information (actual number values)
---
title: "HTML Interactive Dashboard Example"
output:
flexdashboard::flex_dashboard:
storyboard: true
social: menu
source: embed
---
```{r setup, include=FALSE}
library(flexdashboard)
```
### Asset Map for Cincinatti MSA
```{r}
library(leaflet)
library(readxl)
library(htmltools)
assets <- read_excel("C:/Users/hvossler/OneDrive - Measurement Resources Company/Documents/Interactive Document Example/Healthcare Asset Locations.xlsx", sheet = 1)
# make palette
pal <- colorFactor(palette = 'Set1', domain = assets$Type)
assets$Label <- paste(assets$Name, assets$Type, sep = '\n')
assets %>%
leaflet() %>%
addTiles() %>%
addCircleMarkers(~Long, ~Lat,
popup = ~Label,
label = ~lapply(paste(Name, Type, Address, sep = "<br>"), HTML),
fillOpacity = 0.7,
color = ~pal(Type))
```
***
Map assets using coordinate data (latitude, longitude)
- We can adjust the labels to contain additional information
- Colors are based on type of provider, again can be customized
- Background map also customizable
### Barplot of population level data
```{r}
comdata <- read_excel("C:/Users/hvossler/OneDrive - Measurement Resources Company/Documents/Interactive Document Example/Healthcare Asset Locations.xlsx", sheet = 2)
library(ggplot2)
ggplot(comdata, aes(x=reorder(County, `% Severe Housing Cost Burden`), y=`% Severe Housing Cost Burden`, fill=MSA)) +
geom_bar(stat = "identity") +
scale_fill_brewer(palette = "Set1") +
scale_y_continuous(limits = c(0,16)) +
coord_flip() +
theme_minimal() +
geom_text(aes(label=paste0(round(`% Severe Housing Cost Burden`, 2), "%")),
hjust = ifelse(comdata$`% Severe Housing Cost Burden`>0,0,1),
size=3) +
xlab("County")
```
***
Single barplot here to visualize the % Housing Cost burden in each county, color
coded by MSA type.
### Dygraphs provides rich facilities for charting time-series data in R and includes support for many interactive features.
```{r}
library(dygraphs)
lungDeaths <- cbind(mdeaths, fdeaths)
dygraph(lungDeaths, main = "Deaths from Lung Diseases in the UK") %>%
dySeries("mdeaths", label = "Male") %>%
dySeries("fdeaths", label = "Female") %>%
dyOptions(stackedGraph = TRUE) %>%
dyRangeSelector(height = 20) %>%
dyRangeSelector()
```
<https://rstudio.github.io/dygraphs/>
- Automatically plots xts time series objects (or any object convertible to xts).
- Highly configurable axis and series display (including optional second Y-axis).
- Rich interactive features including zoom/pan and series/point highlighting.
- Display upper/lower bars (e.g. prediction intervals) around series.
- Various graph overlays including shaded regions, event lines, and point annotations.
### MetricsGraphics enables easy creation of D3 scatterplots, line charts, and histograms.
```{r}
library(ggplot2)
library(plotly)
nona1 <- comdata %>%
select(CountyFull, County, MSA, `Infant Mortality Rate`, `Life Expectancy`, TotalPopulation) %>%
filter(`Infant Mortality Rate`!="NA") %>%
filter(is.na('Life Expectancy')==FALSE) %>%
filter(is.na(TotalPopulation)==FALSE)
ggplot(nona1, aes(x=`Life Expectancy`, y=round(as.numeric(`Infant Mortality Rate`),3), size=TotalPopulation, color=MSA, label=County)) +
geom_point() +
xlab("Life Expectancy (Years)") +
ylab("Infant Mortality Rate (per 1000 live births)") +
geom_text(hjust=.5, vjust=1.9, size=3)
```
------------------------------------------------------------------------
Another static figure showing infant mortality by life expectancy for each county.
This is a figure that can be made interactive as well without too much hassle, if for isntance
you wanted to hover over the dots for additional information (actual number values)