# Install package from github
devtools::install_github('skysign/KoreaAddressAPI', force = TRUE)
#> Using bundled GitHub PAT. Please add your own PAT to the env var `GITHUB_PAT`
#> Downloading GitHub repo skysign/KoreaAddressAPI@master
#> 
#>   
   checking for file ‘/tmp/Rtmp2tWuJT/remotes3d5627e2d117/skysign-KoreaAddressAPI-907508a/DESCRIPTION’ ...
  
✔  checking for file ‘/tmp/Rtmp2tWuJT/remotes3d5627e2d117/skysign-KoreaAddressAPI-907508a/DESCRIPTION’
#> 
  
─  preparing ‘KoreaAddressAPI’:
#> 
  
   checking DESCRIPTION meta-information ...
  
✔  checking DESCRIPTION meta-information
#> 
  
─  checking for LF line-endings in source and make files and shell scripts
#> 
  
─  checking for empty or unneeded directories
#> 
  
─  building ‘KoreaAddressAPI_0.1.0.tar.gz’
#> 
  
   
#> 
#> Installing package into '/tmp/RtmpMaJU4Q/temp_libpath3cbb1db5e9bb'
#> (as 'lib' is unspecified)

# Install package from local directory
#devtools::install_local('C:/work_git/KoreaAddressAPI', force = TRUE)
library(KoreaAddressAPI)
#> KoreaAddressAPI works based on 2020/04 released addresses of https://www.juso.go.kr

Function in KoreaAddressAPI

KAParse() fucntion

This function is to parse Korea address string as per administrative areas. KAParse read only the column which is pointed by columnName parameter, and add new columns for administrative areas such as SiDoMyeong, SiGunGuMyeong. If we can’t find appropriated administrative area, we mark ‘x’ to its corresponding column.

  1. usage KAParse(dfDirtyJuso, columnName)

  2. parameters dfDirtyJuso Input data frame

columnName column name of input data frame, which will be parsed

  1. return Returned data frame has new columns as corresponding administrative areas, and they have a parsed the name of particular administrative area.

  2. example

dirtyJuso = c('서울특별시 \n\t   동작구 | |   사당동',
              '서울특별시 없는구 자당동')
dfDirtyJuso = data.frame(dirtyJuso)
dfDirtyJuso
#>                               dirtyJuso
#> 1 서울특별시 \n\t   동작구 | |   사당동
#> 2              서울특별시 없는구 자당동

dfCleaned = KAParse(dfDirtyJuso, 'dirtyJuso')
dfCleaned
#>                               dirtyJuso SiDoMyeong SiGunGuMyeong
#> 1 서울특별시 \n\t   동작구 | |   사당동          x             x
#> 2              서울특별시 없는구 자당동          x             x
#>   BeopJeongEupMyeonDongMyeong JiBeonBonBeon JiBeonBuBeon
#> 1                           x             x            x
#> 2                           x             x            x