#install.packages("ggiraphExtra", dependencies = TRUE)
#install.packages("gdtools", dependencies = TRUE)
library(ggiraphExtra)
str(USArrests)
'data.frame':   50 obs. of  4 variables:
 $ Murder  : num  13.2 10 8.1 8.8 9 7.9 3.3 5.9 15.4 17.4 ...
 $ Assault : int  236 263 294 190 276 204 110 238 335 211 ...
 $ UrbanPop: int  58 48 80 50 91 78 77 72 80 60 ...
 $ Rape    : num  21.2 44.5 31 19.5 40.6 38.7 11.1 15.8 31.9 25.8 ...
glimpse(USArrests)
Rows: 50
Columns: 4
$ Murder   <dbl> 13.2, 10.0, 8.1, 8.8, 9.0, 7.9, 3.3, 5.9, 15.4, 17.4, 5.3, 2…
$ Assault  <int> 236, 263, 294, 190, 276, 204, 110, 238, 335, 211, 46, 120, 2…
$ UrbanPop <int> 58, 48, 80, 50, 91, 78, 77, 72, 80, 60, 83, 54, 83, 65, 57, …
$ Rape     <dbl> 21.2, 44.5, 31.0, 19.5, 40.6, 38.7, 11.1, 15.8, 31.9, 25.8, …
head(USArrests)
library(tibble)
crime <- rownames_to_column(USArrests, var = "state")
crime$state <-tolower(crime$state)
head(crime)
states_map <- map_data("state")
ggChoropleth(data = crime, aes(fill = Murder, map_id = state), map = states_map)

library(stringi)
#devtools::install_github("cardiomoon/kormaps2014")
library(kormaps2014)
korpop2 <- rename(korpop2, pop = 총인구_명, name = 행정구역별_읍면동)
ggChoropleth(data = korpop2, aes(fill = pop, map_id = code, tooltip = name), map = kormap2, interactive = T)
data(tbc)
ggChoropleth(data = tbc, aes(fill = NewPts, map_id = code, tooltip = name), map = kormap1, interactive = T)