Type: | Package |
Title: | Making Choropleth Map |
Version: | 2.0.4 |
Description: | You can easily visualize your 'sf' polygons or data.frame with h3 address. While 'leaflet' package is too raw for data analysis, this package can save data analysts' efforts & time with pre-set visualize options. |
Depends: | R (≥ 3.6.0) |
License: | GPL (≥ 3) |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.2 |
URL: | https://github.com/Curycu/valuemap |
BugReports: | https://github.com/Curycu/valuemap/issues |
Imports: | sf (≥ 0.9-0), leaflet (≥ 2.0.0), htmltools (≥ 0.4.0), dplyr (≥ 0.8.3), devtools (≥ 2.2.0), h3jsr (≥ 1.3.0), utils |
NeedsCompilation: | no |
Packaged: | 2022-10-06 14:40:23 UTC; hancu |
Author: | Huncheol Ha |
Maintainer: | Huncheol Ha <hancury@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2022-10-06 20:30:02 UTC |
Polygons of 25 administration area of Seoul, Republic of Korea.
Description
A dataset containing the wgs84 coordinated polygons and other attributes.
Usage
seoul
Format
A sf with 25 rows and 3 variables:
- name
id codes with 4 digit number
- value
numbers of sub-administration area
- geometry
wgs84 base coordinated polygons
...
Source
https://github.com/vuski/admdongkor
H3 addresses within Seoul, Republic of Korea.
Description
A dataset containing the h3 resolution level 8 addresses and other attributes.
Usage
seoul_h3
Format
A data.frame with 1329 rows and 2 variables:
- name
h3 resolution 8 address
- value
meaningless number
...
Source
https://github.com/vuski/admdongkor
Making choropleth map with sf polygons
Description
This function make a leaflet object. You can easily visualize your sf polygons based on "value" column. You have options : background map (= map) color legend boundary values (= legend.cut) color palette for color legend (= palette) showing "value" number on center of polygons (= show.text) color for "value" number text on center of polygons (= text.color)
Usage
valuemap(
data,
map = providers$OpenStreetMap,
legend.cut = NULL,
palette = "Blues",
show.text = TRUE,
text.color = "black",
text.format = function(x) x
)
Arguments
data |
A sf object with polygons who has "name" & "value" columns ("value" column must be numeric type) |
map |
A map name of leaflet::providers |
legend.cut |
A numeric vector which means color legend boundary values |
palette |
A color name of RColorBrewer palettes |
show.text |
A boolean who determines showing "value" number on center of polygons |
text.color |
A color name for "value" number text on center of polygons |
text.format |
A format function for "value" number text on center of polygons |
Value
A leaflet object.
Examples
# Only run this example in interactive R sessions
if (interactive()) valuemap(seoul)
# Emphasize great of equal to 20 polygons
if (interactive()) valuemap(seoul, legend.cut=c(20))
# Visualize without center number on polygons
if (interactive()) valuemap(seoul, legend.cut=c(15,17,20), show.text=FALSE)
# Change color palette & center number on polygons text color, format & change background map
if (interactive())
valuemap(
seoul, map=providers$Stamen.Toner, palette='YlOrRd',
text.color='blue', text.format=function(x) paste(x,'EA')
)
Making choropleth map with data.frame of h3 address
Description
This function make a leaflet object. You can easily visualize your data.frame with h3 address "name" column based on "value" column. You have options : background map (= map) color legend boundary values (= legend.cut) color palette for color legend (= palette) showing "value" number on center of polygons (= show.text) color for "value" number text on center of polygons (= text.color)
Usage
valuemap_h3(
data,
map = providers$OpenStreetMap,
legend.cut = NULL,
palette = "Blues",
show.text = TRUE,
text.color = "black",
text.format = function(x) x
)
Arguments
data |
A data.frame object who has "h3_addr" & "value" columns ("value" column must be numeric type) |
map |
A map name of leaflet::providers |
legend.cut |
A numeric vector which means color legend boundary values |
palette |
A color name of RColorBrewer palettes |
show.text |
A boolean who determines showing "value" number on center of polygons |
text.color |
A color name for "value" number text on center of polygons |
text.format |
A format function for "value" number text on center of polygons |
Value
A leaflet object.
Examples
if (interactive()){
valuemap_h3(seoul_h3, legend.cut=1:6, show.text=FALSE)
}