You can install this package from CRAN
or GitHub
:
I made a demo datasets for this package. You can load it by following method:
library(dplyr)
#> Warning: package 'dplyr' was built under R version 3.6.1
#>
#> 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
library(magrittr)
#> Warning: package 'magrittr' was built under R version 3.6.1
library(hchinamap)
china <- chinadf %>%
dplyr::filter(region == "China")
hchinamap(name = china$name, value = china$value,
width = "100%", height = "400px",
title = "Map of China", region = "China")
Modify the maximum and minimum colors:
For example, map of Anhui:
anhui <- chinadf %>%
dplyr::filter(region == "Anhui")
hchinamap(name = anhui$name, value = anhui$value,
width = "100%", height = "500px",
title = "Map of Anhui", region = "Anhui")
Map of Guangdong:
gd <- chinadf %>%
dplyr::filter(region == "Guangdong")
hchinamap(name = gd$name, value = gd$value,
width = "100%", height = "400px",
title = "Map of Guangdong", region = "Guangdong")
Map of Heilongjiang:
If there are multiple map charts created by this package in a RMarkdown document, use topic parameters carefully, because the charts may interfere with each other.
Here if a very simple ‘shiny’ example:
dir <- system.file("examples", "hchinamap", package = "hchinamap")
setwd(dir)
shiny::shinyAppDir(".")
License
MIT © czxa.top