Comments (3)
Thanks for spotting this issue. I will work on it over the weekend.
Feel free to send a PR if you managed to fix it yourself.
from postcodesior.
Are you using CRAN or GitHub version?
There are still some changes that haven't been pushed to CRAN so the dev (GitHub) version is the latest.
I don't get the error that you mentioned when running PostcodesioR::postcode_lookup("IM26BG")
This line works for me as expected using the dev version.
Was that the only postcode that caused errors? Did you hit the query limit (postcodes.io limits the number of calls)?
from postcodesior.
In response to your questions:
- I was using CRAN version (0.1.1)
- Yes, it was the only postcode that was throwing an error, out of 257.
- No, I wasn't hitting the query limit, I used
map
functions from the {purrr} package to iterate over a vector of postcodes one-by-one.
Solution with CRAN version
In case you are interested I solved the problem by using a combination of functions from {purrr} to ignore errors:
# Load libraries
library(tidyverse)
library(PostcodesioR)
# Create vector of postcodes
postcodes <- c("TEST123", "TEST456", "TEST789")
# Geocoding function to check if postcode is valid, and if so, return lat/lng,
# else silently ignore
geocode <- function(postcode){
if(postcode_validation(postcode)){
p <- postcode_lookup(postcode)
tibble(postcode = postcode,
latitude = purrr::pluck(p, "latitude"),
longitude = purrr::pluck(p, "longitude"))
}
}
# Handle errors safely
safe_geo <- safely(geocode)
# Return lat/lng coords
coords <- map(postcodes, safe_geo) %>%
transpose() %>%
use_series("result") %>%
bind_rows()
Dev version
I updated to the GitHub dev version and indeed it no longer throws an error for the same postcode. Thanks for the update 👍
from postcodesior.
Related Issues (14)
- package is empty HOT 3
- codecov.io push suggestion/issue HOT 1
- Error with CB1 postcodes HOT 2
- Radius parameter not working in nearest_postcode HOT 1
- postcode_validation returns Bad Request error rather than FALSE HOT 10
- Help vignette for bulk_postcode_lookup is inaccurate HOT 2
- bulk_postcode_lookup vignette returns 400 error HOT 3
- bulk_postcode_lookup does not ignore spaces
- Feature request: bulk_postcode_lookup should accept a character vector and/or `...` HOT 2
- Submit to CRAN? HOT 4
- Missing postcode HOT 4
- Only centroids available as opendata? HOT 1
- Is there a 100 bulk limit? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from postcodesior.