geobr
geobr copied to clipboard
refactor function cep_to_state
This PR refactor cep_to_state function.
- Remove nesteds
ifelse, uses a structure that is easier to maintain - Remove unnecessary vectorization (
ifelseand&) - Stricter verification, now
cep_to_state("7900000000000000")raise a error. Currently return"MS"
Hi @aspeddro . Thank you for your contribution and pleace accept my apologies for taking so much time to get back to you. The code of the function looks much nicer now. However, the new function does not pass the tests in test-cep_to_state.R.
The function should be able to throw an informative error message in these situations below:
cep_to_state(cep = 'aaaa')
cep_to_state()
I've added a few checks that were missing. Thanks!