| Type: | Package | 
| Title: | China Administrative Divisions Geospatial Shapefile Data | 
| Version: | 0.1.0 | 
| Description: | Geospatial shapefile data of China administrative divisions to the county/district-level. | 
| Depends: | R (≥ 3.6) | 
| License: | GPL-3 | 
| LazyData: | TRUE | 
| Imports: | sf | 
| Suggests: | dplyr, ggplot2, RColorBrewer, showtext | 
| Collate: | "data.R" "globals.R" "helpers.R" | 
| URL: | https://github.com/xmc811/mapchina | 
| BugReports: | https://github.com/xmc811/mapchina/issues | 
| RoxygenNote: | 7.1.1 | 
| Encoding: | UTF-8 | 
| NeedsCompilation: | no | 
| Packaged: | 2020-09-25 20:25:34 UTC; mingchuxu | 
| Author: | Mingchu Xu [aut, cre] | 
| Maintainer: | Mingchu Xu <mxu.china@gmail.com> | 
| Repository: | CRAN | 
| Date/Publication: | 2020-09-29 08:50:05 UTC | 
China administraive division shapefile data
Description
A simple feature dataframe of China administrative divisions. The data was originally queried from OpenStreetMap and manually corrected for errors in QGIS
Usage
china
Format
A simple feature dataframe of China administrative divisions
- Code_County
- Code of county-level administrative division. 
- Code_Perfecture
- Code of perfecture-level administrative division. 
- Code_Province
- Code of province-level administrative division. 
- Name_Province
- Chinese name of province-level administrative division. 
- Name_Perfecture
- Chinese name of perfecture-level administrative division. 
- Name_County
- Chinese name of county-level administrative division. 
- Pinyin
- Chinese Pinyin. 
- Pop_2000
- Population in Year 2000. 
- Pop_2010
- Population in Year 2010. 
- Pop_2017
- Estimated population in Year 2017. 
- Pop_2018
- Estimated population in Year 2018. 
- Area
- Land area in square km. 
- Density
- Population density in every square km. 
- Geometry
- vector geometry of the administrative division. 
Source
<https://www.openstreetmap.org/> <http://www.mca.gov.cn/article/sj/xzqh/1980/2019/202002281436.html>
Examples
head(china)
Generate map colors by greedy coloring algorithm so that bordering features are colored differently
Description
Generate map colors by greedy coloring algorithm so that bordering features are colored differently
Usage
generate_map_colors(sf)
Arguments
| sf | An simple feature dataframe - the shapefile of investigation | 
Value
An integer vector - the indices of map colors
Examples
generate_map_colors(head(china, 10))
Get the mex number of a vector
Description
Get the mex number of a vector
Usage
get_mex(v, colors, idx)
Arguments
| v | An logical vector - the intersection vector | 
| colors | An integer vector - the color assignment vector | 
| idx | An integer - the index | 
Value
An integer
Examples
get_mex(c(TRUE,TRUE,FALSE,FALSE,TRUE), 1:5, 4)