library(MazamaLocationUtils)
# Fremont, Seattle 47.6504, -122.3509
# Magnolia, Seattle 47.6403, -122.3997
# Downtown Seattle 47.6055, -122.3370
fremont_x <- jitter(rep(-122.3509, 10), .0005)
fremont_y <- jitter(rep(47.6504, 10), .0005)
magnolia_x <- jitter(rep(-122.3997, 8), .0005)
magnolia_y <- jitter(rep(47.6403, 8), .0005)
downtown_x <- jitter(rep(-122.3370, 3), .0005)
downtown_y <- jitter(rep(47.6055, 3), .0005)
# Apply clustering
tbl <-
dplyr::tibble(
longitude = c(fremont_x, magnolia_x, downtown_x),
latitude = c(fremont_y, magnolia_y, downtown_y)
) %>%
clusterByDistance(
clusterDiameter = 1000
)
plot(tbl$longitude, tbl$latitude, pch = tbl$clusterID)
Run the code above in your browser using DataLab