Filter all observations in a data.frame that fall within a circle of a specified radius drawn around a given latitude and longitude point.
points_in_circle(
data,
lon_center,
lat_center,
lon = lon,
lat = lat,
radius = 200
)
data.frame with at least columns for longitude and latitude.
numeric. Representing the longitude of the circle's center.
numeric. Representing the latitude of the circle's center.
column name in data
containing longitudes
(default is lon
).
column name in data
containing latitudes
(default is lat
).
radius of the circle in meters (default is 200m).
A subset of the input data.frame containing only the observations that fall within the specified circle.
points_in_circle(Groningen, lon_center = 6.571561, lat_center = 53.21326,
radius = 60)
#> # A tibble: 3 × 10
#> street number letter suffix postal_code city lon lat amount distance_m
#> <chr> <int> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 Heresing… 5 NA NA 9711EP Gron… 6.57 53.2 5 31.4
#> 2 Heresing… 11 NA NA 9711ER Gron… 6.57 53.2 11 47.8
#> 3 Zuiderpa… 1003 NA NA 9724AK Gron… 6.57 53.2 1003 57.6