Created
June 10, 2019 10:57
-
-
Save uribo/40a0e67b9625062e816defabb88f8656 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subset_kanto_citycode <- function(data, city_code, .honsyu = TRUE) { | |
d <- | |
data %>% | |
# 関東 (一都六県) %>% | |
dplyr::filter(stringr::str_detect(!!rlang::enquo(city_code), | |
paste0("^(", | |
paste(stringr::str_pad(seq(8, 14), width = "2", pad = "0"), collapse = "|"), | |
")"))) | |
if (rlang::is_true(.honsyu)) { | |
d <- | |
d %>% | |
# 本州のみ | |
dplyr::filter(stringr::str_detect(!!rlang::enquo(city_code), "^13", negate = TRUE) | | |
!!rlang::enquo(city_code) < 13361) | |
} | |
d | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment