if (FALSE) { # identical(tolower(Sys.getenv("NOT_CRAN")), "true")
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)
}
Run the code above in your browser using DataLab