| gravity {accessibility} | R Documentation | 
Gravity-based accessibility measures
Description
Calculates gravity-based accessibility using a decay function specified by the user.
This function is generic over any kind of numeric travel cost, such as distance, time and money.
Usage
gravity(
  travel_matrix,
  land_use_data,
  opportunity,
  travel_cost,
  decay_function,
  group_by = character(0),
  active = TRUE,
  fill_missing_ids = TRUE
)
Arguments
| 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 string. The name of the column in  | 
| decay_function | 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  | 
Value
A data frame containing the accessibility estimates for each
origin/destination (depending if active is TRUE or FALSE) in the
travel matrix.
Examples
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"))
df_linear <- gravity(
  travel_matrix,
  land_use_data,
  decay_function = decay_linear(cutoff = 50),
  opportunity = "schools",
  travel_cost = "travel_time"
)
head(df_linear)
df_exp <- gravity(
  travel_matrix,
  land_use_data,
  decay_function = decay_exponential(decay_value = 0.5),
  opportunity = "schools",
  travel_cost = "travel_time"
)
head(df_exp)