-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
88 lines (67 loc) · 1.58 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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# citygeocoder
<!-- badges: start -->
<!-- badges: end -->
A simple and fast city-level geocoder and reverse geocoder for the US...
## Installation
You can install the development version from [GitHub](https://github.com/cjtexas/citygeocoder) with:
``` r
# install.packages("remotes")
remotes::install_github("cjtexas/citygeocoder")
```
## Examples
1. Geocode
```{r}
library(citygeocoder)
citygeocoder::geocode("Austin", "TX")
```
2. Reverse Geocode
```{r}
library(citygeocoder)
citygeocoder::reverse_geocode(lon = -98.7654321, lat = 34.56789)
```
3. Batch Mode!
```{r}
df1 <-
read.table(
text =
"City | State
Scranton | PA
Oakland | CA
New York | NY
Columbus | IN",
header = T,
sep = "|",
stringsAsFactors = FALSE,
strip.white = TRUE
)
citygeocoder::geocode(df1$City, df1$State)
df2 <-
read.table(
text =
"Lon | Lat
-95.55555 | 37.77777
-96.66666 | 36.66666
-97.77777 | 35.55555
-98.88888 | 34.44444
-99.99999 | 33.33333",
header = T,
sep = "|",
stringsAsFactors = FALSE,
strip.white = TRUE
)
reverse_geocode(df2$Lon, df2$Lat)
```
4. I've also included an example Shiny App that demonstrates the Package's functions - NOTE: Requires Additional Packages (leaflet, shiny, shinydashboard)
```citygeocoder:::shiny_example()```