ropensci / PostcodesioR

API wrapper around postcodes.io - free UK postcode lookup and geocoder
https://docs.ropensci.org/PostcodesioR
39 stars 7 forks source link

`bulk_postcode_lookup()` supports vector and/or `...` input #19

Open dave-lovell opened 7 months ago

dave-lovell commented 7 months ago

bulk_postcode_lookup() used to only work accept this syntax:

bulk_postcode_lookup(list(postcodes = c("PR30SG", "M456GN", "EX165BL"))

But now it also supports this syntax:

## Postcodes can be provided as individual arguments
bulk_postcode_lookup("PR30SG", "M456GN", "EX165BL")
## Or as one or more vectors:
bulk_postcode_lookup(c("PR30SG", "M456GN"), "EX165BL")

The main change is only a couple of lines:

bulk_postcode_lookup <- function(...) {
  dots <- unlist(c(...), recursive = TRUE)
  postcodes <- list(postcodes = dots)
#...
}
dave-lovell commented 6 months ago

@erzk are you able to review this? Happy to amend if you think another approach is needed