Created
April 10, 2025 14:37
-
-
Save martinctc/45f01b71b0f90ac0a0dc73c661e1721e to your computer and use it in GitHub Desktop.
[Convert postcodes to location] #R
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
| library(tidyverse) | |
| library(PostcodesioR) | |
| # Customize with your own path | |
| df_with_postcodes <- read_csv( | |
| "path/data/postcodes.csv" | |
| ) | |
| # Update with column name containing postcode | |
| postcode_column <- df_with_postcodes[["postcode"]] | |
| # Return result and convert to tibble | |
| returned_df <- | |
| postcode_column %>% | |
| map_dfr(postcode_lookup) %>% | |
| as_tibble() | |
| # Save output to CSV | |
| write_csv( | |
| returned_df, | |
| "path/data/postcodes_output.csv" | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment