Created
February 22, 2017 14:00
-
-
Save MilesMcBain/8febe19be00a45036d9666976ceb6276 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
dat <- readr::read_csv("municipality\n- Ticino\n>> Distretto di Bellinzona\n......5001 Arbedo-Castione\n......5002 Bellinzona\n......5003 Cadenazzo\n......5004 Camorino\n") | |
dat %>% mutate(municipality = gsub(pattern = '[\\.\\>]|^-', | |
replacement = "", | |
municipality)) %>% | |
separate(col = municipality, | |
sep = '(?<=[0-9])\\s', | |
into = c ("code","municipality"), | |
fill = "left") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment