Import Statements

## Import libraries
library(knitr)
library(leaflet)
library(maps)
library(plotly)
## Loading required package: ggplot2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
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
## Load data
states <- map("state", fill = TRUE, plot = FALSE)

Plot Map of US

## Plot US
leaflet(data = states) %>%
  addTiles() %>%
  addPolygons(fillColor = topo.colors(10, alpha = NULL), stroke = FALSE)

Plot Distribution of Names

## Table of letters
letters <- data.frame(table(substr(states$names, 1, 1)))

## Donut plot
plot_ly(labels = ~letters$Var1, values = ~letters$Freq) %>%
  add_pie(hole = 0.6) %>%
  layout(title = "First Letter of States", showlegend = FALSE)