ropensci / opencage

:globe_with_meridians: R package for the OpenCage API -- both forward and reverse geocoding :globe_with_meridians:
https://docs.ropensci.org/opencage
87 stars 11 forks source link

Geocoding throws errors with NAs #85

Closed jessesadler closed 5 years ago

jessesadler commented 5 years ago

oc_forward(), oc_reverse(), and their data frame counterparts throw errors with NA in placename, latitude, or longitude.

oc_forward() error is due to oc_process(): Error in map_lgl(.x, .p, ...) : object 'query' not found

oc_reverse() error is due to oc_check_query(): Error in if (!(dplyr::between(longitude, -180, 180))) { : missing value where TRUE/FALSE needed

I think that an NA in any of the query arguments should just return an NA. When return is one of the list options, it can just be NA. If return = "df_list" it can be tibble::tibble(query = NA). This can be done in oc_process() and returned before query sent to opencage.

Fixes

jessesadler commented 5 years ago

Closed with PR #89