A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ipeaGIT/r5r/issues/235 below:

accessibilty() always returns an integer · Issue #235 · ipeaGIT/r5r · GitHub

Brief description of the problem:

I love the ability to specify a non-step decay function in the accessibility function, but we lose some of the benefit when the resulting accessibility values are apparently rounded to the integer.

In the example below, I think I've specified a decay function that should decrease linearly from 1 to zero as travel time increases from 0 to 20 minutes. Since opportunities are never fully-weighted in this case, it seems like the accessibility values should vary continuously and return very few, if any, whole numbers. But with the rounding that's apparently happening, the results are mostly the same as what I'd get with a step function with a cutoff at 10 minutes.

I realize this is almost definitely an r5/Conveyal issue rather than an r5r issue, so maybe there's nothing to be done (other than maybe calculating travel times with r5, but applying the decay function outside of r5).

Reproducible example here
library(r5r)
library(dplyr)

# build transport network
data_path <- system.file("extdata/poa", package = "r5r")
r5r_core <- setup_r5(data_path = data_path, temp_dir = TRUE, verbose = FALSE)

# load origin/destination points
points <- read.csv(file.path(data_path, "poa_hexgrid.csv"))

access_linear_decay <- accessibility(r5r_core, 
                        origins = points, 
                        destinations = points,
                        opportunities_colname = "schools",
                        decay_function = "linear",
                        cutoffs = 10,
                        decay_value = 20, 
                        verbose=FALSE) %>%
  rename(linear_decay = accessibility)

access_step <- accessibility(r5r_core, 
                        origins = points, 
                        destinations = points,
                        opportunities_colname = "schools",
                        decay_function = "step",
                        cutoffs = 10, 
                        verbose=FALSE) %>%
  rename(step_decay = accessibility)

comparison <- full_join(access_linear_decay, access_step) %>%
  mutate(diff = step_decay - linear_decay)

head(comparison, 20)

table(comparison$diff)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4