if (FALSE) { # identical(tolower(Sys.getenv("NOT_CRAN")), "true")
# the example below is based on Soukhov et al. (2023) paper
travel_matrix <- data.table::data.table(
from_id = rep(c("A", "B", "C"), each = 3),
to_id = as.character(rep(1:3, 3)),
travel_time = c(15, 30, 100, 30, 15, 100, 100, 100, 15)
)
land_use_data <- data.table::data.table(
id = c("A", "B", "C", "1", "2", "3"),
population = c(50000, 150000, 10000, 0, 0, 0),
jobs = c(0, 0, 0, 100000, 100000, 10000)
)
df <- spatial_availability(
travel_matrix,
land_use_data,
opportunity = "jobs",
travel_cost = "travel_time",
demand = "population",
decay_function = decay_exponential(decay_value = 0.1)
)
df
detailed_df <- spatial_availability(
travel_matrix,
land_use_data,
opportunity = "jobs",
travel_cost = "travel_time",
demand = "population",
decay_function = decay_exponential(decay_value = 0.1),
detailed_results = TRUE
)
detailed_df
}
Run the code above in your browser using DataLab