[Experimental]

read_zipcode(path, type = c("oogaki", "kogaki", "roman", "jigyosyo"))

Arguments

path

local file path or zip file URL

type

Input file type, one of "oogaki", "kogaki", "roman", "jigyosyo"

Value

tibble

Details

Reads zip-code data in csv format provided by japan post group and parse it as a data.frame. Corresponds to the available "oogaki", "kogaki", "roman" and "jigyosyo" types. These file types must be specified by the argument.

Examples

# Input sources
read_zipcode(path = system.file("zipcode_dummy/13TOKYO_oogaki.CSV", package = "zipangu"),
             type = "oogaki")
#> # A tibble: 1 × 15
#>   jis_code old_zip_code zip_code prefecture_kana city_kana street_kana
#>   <chr>    <chr>        <chr>    <chr>           <chr>     <chr>      
#> 1 13101    100          1000001  トウキヨウト    チヨダク  チヨダ     
#> # ℹ 9 more variables: prefecture <chr>, city <chr>, street <chr>,
#> #   is_street_duplicate <dbl>, is_banchi <dbl>, is_cyoumoku <dbl>,
#> #   is_zipcode_duplicate <dbl>, status <dbl>, modify_type <dbl>
read_zipcode(system.file("zipcode_dummy/13TOKYO_kogaki.CSV", package = "zipangu"),
             "oogaki")
#> # A tibble: 1 × 15
#>   jis_code old_zip_code zip_code prefecture_kana city_kana street_kana
#>   <chr>    <chr>        <chr>    <chr>           <chr>     <chr>      
#> 1 13101    100          1000001  トウキヨウト    チヨダク  チヨダ     
#> # ℹ 9 more variables: prefecture <chr>, city <chr>, street <chr>,
#> #   is_street_duplicate <dbl>, is_banchi <dbl>, is_cyoumoku <dbl>,
#> #   is_zipcode_duplicate <dbl>, status <dbl>, modify_type <dbl>
read_zipcode(system.file("zipcode_dummy/KEN_ALL_ROME.CSV", package = "zipangu"),
             "roman")
#> # A tibble: 1 × 7
#>   zip_code prefecture city     street prefecture_roman city_roman street_roman
#>   <chr>    <chr>      <chr>    <chr>  <chr>            <chr>      <chr>       
#> 1 1000001  東京都     千代田区 千代田 Tokyo To         Chiyoda Ku Chiyoda     
read_zipcode(system.file("zipcode_dummy/JIGYOSYO.CSV", package = "zipangu"),
             "jigyosyo")
#> # A tibble: 1 × 13
#>   jis_code name_kana                    name  prefecture city  street street_sub
#>   <chr>    <chr>                        <chr> <chr>      <chr> <chr>  <chr>     
#> 1 13101    ニツポンユウビン カブシキガ… 日本… 東京都     千代… 大手町 2-3-1     
#> # ℹ 6 more variables: jigyosyo_identifier <chr>, old_zip_code <chr>,
#> #   grouped <chr>, individual_id <int>, multiple_type <int>, update_type <int>
if (FALSE) { # \dontrun{
# Or directly from a URL
read_zipcode("https://www.post.japanpost.jp/zipcode/dl/jigyosyo/zip/jigyosyo.zip")
} # }