README.md

nusantr: Indonesia R package

We R Nusantara!

nusantr is an R package which contains:

Installation

You need to use sf package to enable the class of sf data frame.

# 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".

The data for Indonesia map will be dowloaded from GADM and the data for Jakarta map is get from from Jakarta Smart City.

library(sf)
library(nusantr)
# get jakarta map for 'kelurahan' level
jakarta_kelurahan <- id_map("jakarta", "kelurahan")
jakarta_kelurahan
#> Simple feature collection with 377 features and 8 fields
#> geometry type:  POLYGON
#> dimension:      XY
#> bbox:           xmin: 106.4 ymin: -6.373 xmax: 107 ymax: -5.184
#> epsg (SRID):    4326
#> proj4string:    +proj=longlat +datum=WGS84 +no_defs
#> # A tibble: 377 x 9
#>   provinsi_id provinsi kota_id kota  kecamatan_id kecamatan kelurahan_id
#>   <chr>       <chr>    <chr>   <chr> <chr>        <chr>     <chr>       
#> 1 31          DKI Jak… 3171    Jaka… 3171010      Jagakarsa 3171010001  
#> 2 31          DKI Jak… 3172    Jaka… 3172020      Ciracas   3172020001  
#> 3 31          DKI Jak… 3172    Jaka… 3172030      Cipayung  3172030001  
#> 4 31          DKI Jak… 3172    Jaka… 3172030      Cipayung  3172030003  
#> 5 31          DKI Jak… 3172    Jaka… 3172010      Pasar Re… 3172010001  
#> # … with 372 more rows, and 2 more variables: kelurahan <chr>,
#> #   geometry <POLYGON [°]>

Datasets

There are various datasets included on this package such as: Transjakarta data, KRL data, Indonesia name data, etc.

# transjakarta halte data
transjakarta
#> # A tibble: 1,555 x 6
#>   halte_id          halte_name  latitude longitude corridor_cnt schedule_id
#>   <chr>             <chr>          <dbl>     <dbl>        <int> <list>     
#> 1 idjkb_1-10 Sarin… Sarinah        -6.19      107.           10 <chr [10]> 
#> 2 idjkb_1-11 Bank … Bank Indon…    -6.18      107.            9 <chr [9]>  
#> 3 idjkb_1-12 Monas  Monumen Na…    -6.18      107.           16 <chr [16]> 
#> 4 idjkb_1-13 Harmo… Harmoni        -6.17      107.           18 <chr [18]> 
#> 5 idjkb_1-14 Sawah… Sawah Besar    -6.16      107.            5 <chr [5]>  
#> # … with 1,550 more rows

# transjakarta route data
transjakarta_route
#> Simple feature collection with 482 features and 11 fields
#> geometry type:  LINESTRING
#> dimension:      XY
#> bbox:           xmin: 106.6 ymin: -6.396 xmax: 107 ymax: -6.091
#> epsg (SRID):    4326
#> proj4string:    +proj=longlat +datum=WGS84 +no_defs
#> # A tibble: 482 x 12
#>   transport_id schedule_id corridor_id corridor_name corridor_color
#>   <chr>        <chr>       <chr>       <chr>         <chr>         
#> 1 idjkb_brt    idjkb_1     1           Blok M - Kota D02027        
#> 2 idjkb_brt    idjkb_1     1           Blok M - Kota D02027        
#> 3 idjkb_brt    idjkb_1     1           Blok M - Kota D02027        
#> 4 idjkb_brt    idjkb_1     1           Blok M - Kota D02027        
#> 5 idjkb_brt    idjkb_1     1           Blok M - Kota D02027        
#> # … with 477 more rows, and 7 more variables: route_id <chr>,
#> #   route_name <chr>, direction <int>, validity <chr>, is_main <lgl>,
#> #   is_main_reverse <lgl>, geometry <LINESTRING [°]>

NIK

You also can convert NIK (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.

nik_to_all("3173060101000010")
#> $gender
#> [1] Laki-laki
#> Levels: Laki-laki Perempuan
#> 
#> $bd
#> [1] "2000-01-01"
#> 
#> $city
#> [1] "KOTA JAKARTA PUSAT"
#> 
#> $prov
#> [1] "DKI JAKARTA"


rasyidstat/nusantr documentation built on Nov. 11, 2019, 9:16 p.m.