-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathREADME.Rmd
100 lines (69 loc) · 4.49 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
---
title: "PostcodesioR"
output: rmarkdown::github_document
---
# PostcodesioR <img src='man/figures/logo.png' align="right" height="139" />
[](https://travis-ci.org/ropensci/PostcodesioR)
[](https://www.gnu.org/licenses/gpl-3.0.html)
[](https://github.com/ropensci/software-review/issues/176)
[](https://www.repostatus.org/)
[](https://cran.r-project.org/package=PostcodesioR)
[](https://doi.org/10.21105/joss.05334)

An API wrapper around [postcodes.io](https://postcodes.io/) - free UK postcode lookup and geocoder. This package helps to find and transform information about UK administrative geography like postcodes, LSOA, MSOA, constituencies, counties, wards, districts, CCG or NUTS.
The package is based exclusively on open data provided by postcodes.io. PostcodesioR can be used by data scientists or social scientists working with geocoded UK data. A common task when working with such data is aggregating geocoded data on different administrative levels, e.g. turning postcode-level data into counties or regions. This package can help in achieving this and in many other cases when changing the aggregation of geographic data is required.
## Installation
This package can be installed from GitHub (developmental version) or CRAN (stable).
In order to install PostcodesioR use one of the following commands:
```{r, eval = FALSE}
# stable version
install.packages("PostcodesioR")
```
or
```{r, eval = FALSE}
# developmental version
if(!require("devtools")) {
install.packages("devtools")
}
devtools::install_github("ropensci/PostcodesioR")
```
## Loading
Load the package by typing
```{r, warning = FALSE, message = FALSE}
library(PostcodesioR)
```
## Examples
Where possible, I tried to return a data frame. Unfortunately, a lot of API calls return more complex data and in those cases it is safer to use lists. The API limits the number of returned calls. Check functions' documentation for more details.
For additional information about the returned data and the function calls see the original [documentation](https://postcodes.io/docs).
The main function of this package provides information related to a given postcode
```{r, message = FALSE, warning = FALSE}
lookup_result <- postcode_lookup("EC1Y8LX")
#overview
str(lookup_result)
```
Check the [vignette](https://docs.ropensci.org/PostcodesioR/articles/Introduction.html) to see all functions in action.
## Citation
Please cite this package if it is used in a publication
`Walczak, E. J., (2023). PostcodesioR: An R package for UK geocoding. Journal of Open Source Software, 8(84), 5334, https://doi.org/10.21105/joss.05334`
BibTeX entry is here:
```{latex, echo=TRUE, eval=FALSE}
@article{postcodesior:2023,
title = {{PostcodesioR: An R package for UK geocoding}},
author = {Eryk J. Walczak},
journal = {Journal of Open Source Software},
volume = {8},
number = {84},
pages = {5334},
year = {2023},
doi = {10.21105/joss.05334},
note = {R package version 0.3.1},
url = {https://cran.r-project.org/web/packages/PostcodesioR/},
}
```
## Notes
Currently, there is a limit to the number of API calls that can be made. However, [postcodes.io](https://postcodes.io/) provides full list of geolocation data that can be used locally without limitations. The original data is sourced from [Office for National Statistics Data Portal](https://geoportal.statistics.gov.uk/).
That [file](https://github.com/ideal-postcodes/postcodes.io/blob/master/latest) is rather large so I didn't include it in the package.
Go to the package's [website](https://docs.ropensci.org/PostcodesioR/) or to my [blog](https://walczak.org/tag/postcodesior/) for more examples.
## Code of Conduct
Please note that this project is released with a [Contributor Code of Conduct](https://github.com/ropensci/PostcodesioR/blob/master/CONDUCT.md). By participating in this project you agree to abide by its terms.
[](https://ropensci.org)