View source: R/cumulative_cutoff.R
cumulative_cutoff | R Documentation |
Calculates the number of opportunities accessible under a given specified travel cost cutoff.
This function is generic over any kind of numeric travel cost, such as distance, time and money.
cumulative_cutoff(
travel_matrix,
land_use_data,
opportunity,
travel_cost,
cutoff,
group_by = character(0),
active = TRUE,
fill_missing_ids = TRUE
)
travel_matrix |
A data frame. The travel matrix describing the costs
(i.e. travel time, distance, monetary cost, etc.) between the origins and
destinations in the study area. Must contain the columns |
land_use_data |
A data frame. The distribution of opportunities within
the study area cells. Must contain the columns |
opportunity |
A string. The name of the column in |
travel_cost |
A |
cutoff |
Either a |
group_by |
A |
active |
A logical. Whether to calculate active accessibility (the of opportunities that can be reached from a given origin, the default) or passive accessibility (by how many people each destination can be reached). |
fill_missing_ids |
A |
A data frame containing the accessibility estimates for each
origin/destination (depending if active
is TRUE
or FALSE
) in the
travel matrix.
Other cumulative access:
cumulative_interval()
data_dir <- system.file("extdata", package = "accessibility")
travel_matrix <- readRDS(file.path(data_dir, "travel_matrix.rds"))
land_use_data <- readRDS(file.path(data_dir, "land_use_data.rds"))
# active accessibility: number of schools accessible from each origin
df <- cumulative_cutoff(
travel_matrix = travel_matrix,
land_use_data = land_use_data,
cutoff = 30,
opportunity = "schools",
travel_cost = "travel_time"
)
head(df)
df <- cumulative_cutoff(
travel_matrix = travel_matrix,
land_use_data = land_use_data,
cutoff = c(30, 60),
opportunity = "schools",
travel_cost = "travel_time"
)
head(df)
# passive accessibility: number of people that can reach each destination
df <- cumulative_cutoff(
travel_matrix = travel_matrix,
land_use_data = land_use_data,
cutoff = 30,
opportunity = "population",
travel_cost = "travel_time",
active = FALSE
)
head(df)
# using multiple travel costs
pareto_frontier <- readRDS(file.path(data_dir, "pareto_frontier.rds"))
df <- cumulative_cutoff(
pareto_frontier,
land_use_data = land_use_data,
opportunity = "jobs",
travel_cost = c("travel_time", "monetary_cost"),
cutoff = list(c(20, 30), c(0, 5, 10))
)
head(df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.