simulate_catchments.Rd
Generate a random population of consumers and providers.
simulate_catchments(n = 100, weight = 1, ..., consumers_range = c(10,
5000), long_center = -99, long_spread = 1, lat_center = 40,
lat_spread = 1, as_sf = TRUE)
Number of consumers to generate.
Weight method used on Euclidean distances between consumers and providers.
Passes additional arguments to catchment_weight
.
A numeric vector with entries for minimal and maximal consumer counts from which to sample.
Longitude to randomly place consumers around.
Standard deviation of the consumer's longitude distribution.
Latitude to randomly place consumers around.
Standard deviation of the consumer's latitude distribution.
Logical; if FALSE
, consumer and provider data are returned in regular data.frame
s.
A list with consumers
, providers
, cost
, and weight
entries.
pop <- simulate_catchments()
if (require("leaflet", quiet = TRUE)) {
leaflet(pop$providers) |>
addCircles(
radius = 1e5, color = "#666", stroke = FALSE
) |>
addCircles(
data = pop$consumers, label = ~ paste0("Consumers: ", count, ", Access: ", access)
) |>
addCircles(
color = "#000", label = ~ paste("Provider", id)
)
}