# Specify the file path of the Excel file
excel_file_path <- "statistic_covid_clean.xlsx"
# Read the Excel file into R
excel_data <- read_excel(excel_file_path)
# View the data
View(excel_data)
## Error in check_for_XQuartz(file.path(R.home("modules"), "R_de.so")): X11 library is missing: install XQuartz from www.xquartz.org
install.packages("sf")
## Error in contrib.url(repos, "source"): trying to use CRAN without setting a mirror
library(sf)
## Linking to GEOS 3.11.0, GDAL 3.5.3, PROJ 9.1.0; sf_use_s2() is TRUE
japan <- read_sf("gadm41_JPN_shp", "gadm41_JPN_1")
d1= left_join(japan, excel_data, by=c("NAME_1"= "Prefecture"))
View(d1)
## Error in check_for_XQuartz(file.path(R.home("modules"), "R_de.so")): X11 library is missing: install XQuartz from www.xquartz.org
hcmap(
  "countries/jp/jp-all",
  data = d1,
  value = "Number of deaths",
  dataLabels = list(enabled = TRUE, format = "{point.name}"),
  borderColor = "#000000",
  borderWidth = 0.1,
) %>% 
 hc_title(
    text = "<b>Number of Deaths by COVID-19 in Japan March 17, 2022</b>",
    margin = 20,
    align = "center",
    style = list(color = "#000", useHTML = TRUE)
  ) %>% 
  hc_subtitle(
    text = "intensity of COVID-19 by Prefecture",
    align = "center",
    style = list(color = "#000", fontWeight = "bold")
  ) %>% 
  hc_add_annotation(
    text = "created by Lily Gomi, December 11, 2023, Data by Statista"
  )