New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add japan zip-code utility functions #6
Conversation
- 日本郵便が提供する郵便番号データ(csv形式)を読み込む - 数値・文字列が7桁の郵便番号であるか - 郵便番号文字列に含まれるハイフンを除外または追加
|
zipcode_spacer <- function(x, remove = FALSE) { | ||
purrr::map_chr(x, | ||
~ if (rlang::is_true(is_zipcode(.x))) | ||
if (rlang::is_false(remove)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ややこしいので rlang::is_false
なしでもよさそう?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
うーむ、こちらは残しておきたいです
Summary
郵便番号に関する4つの関数を追加。
read_zipcode()
... 日本郵便が提供する郵便番号データ(csv形式)を読み込む。コンピュータ上のファイルかURLでの指定でzipファイルを直接読み込む(この処理にdl_zipcode_file()
を利用)dl_zipcode_file()
... 郵便番号データのzipファイルをダウンロード・展開するis_zipcode()
... 数値・文字列が7桁の郵便番号であるかzipcode_spacer()
... 郵便番号文字列に含まれるハイフンを除外または追加Demo
read_zipcode()
ダウンロード可能な4種類のファイルに対応済み。これらのファイルの種類は引数
type
でユーザが指定する。oogaki
... 読み仮名データの促音・拗音を小書きで表記しないものkogaki
... 読み仮名データの促音・拗音を小書きで表記するものroman
... ローマ字jigyosyo
... 事業所is_zipcode()
zipcode_spacer()
Reviewer Checkpoint
is_zipcode()
の郵便番号判定をより厳密にする必要があるかread_zipcode()
の exampleおよびtest, coverageのためにrawデータを保存するか。具体的にはsystem.file("japanpost/oogaki/13TOKYO.CSV", package = "zipangu")
のような形式で呼び出せるようにしておくかどうか。read_zipcode()
が返却する列名は妥当か。日本語との対応を確認する必要があるRelated issues
#5 の第一歩として、日本郵便提供の郵便番号データをRで読み込みやすいように。