-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathREADME.Rmd
79 lines (55 loc) · 2.29 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
output:
github_document:
html_preview: true
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
options(tibble.print_min = 5, tibble.print_max = 5)
```
# nusantr: Indonesia R package <img src="man/figures/logo.png" align="right" height="140" width="120"/>
*We R Nusantara!*
`nusantr` is an R package which contains:
- Indonesia map in spatial data frame format (Indonesia map should be downloaded first on [GADM](https://gadm.org/))
- Datasets related to Indonesia such as: Transjakarta data, KRL data, Indonesia name data, etc.
- A simple function to convert [NIK](https://en.wikipedia.org/wiki/Indonesian_identity_card) to location, gender and birthdate.
## Installation
You need to use `sf` package to enable the class of sf data frame.
```{r, eval = FALSE}
# install.packages("devtools")
install.packages("sf")
install.packages("tidyverse")
devtools::install_github("rasyidstat/nusantr")
```
## Example
### Indonesia Map
You can get Indonesia map by using `id_map` function that will return sf spatial data frame. It contains two parameters: region and level and currently only contains two regions: "indonesia" and "jakarta".
- "indonesia" consists of two geographical levels such as "provinsi" and "kota".
- "jakarta" consists of three geographical levels such as "kecamatan", "kelurahan" and "rw".
The data for Indonesia map will be dowloaded from [GADM](http://www.gadm.org/) and the data for Jakarta map is get from from [Jakarta Smart City](http://smartcity.jakarta.go.id).
```{r, message=FALSE, warning=FALSE}
library(sf)
library(nusantr)
```
```{r}
# get jakarta map for 'kelurahan' level
jakarta_kelurahan <- id_map("jakarta", "kelurahan")
jakarta_kelurahan
```
### Datasets
There are various datasets included on this package such as: Transjakarta data, KRL data, Indonesia name data, etc.
```{r}
# transjakarta halte data
transjakarta
# transjakarta route data
transjakarta_route
```
### NIK
You also can convert [NIK](https://en.wikipedia.org/wiki/Indonesian_identity_card) (*Nomor Induk Kependudukan*) or KTP ID to location (city and province), gender and birthdate using `nik_to_all`, `nik_to_gender`, `nik_to_bd`, `nik_to_city` or `nik_to_prov`.
```{r}
nik_to_all("3173060101000010")
```