Skip to content

Warning in cost_to_closest() #27

@dhersz

Description

@dhersz
library(r5r)
#> Please make sure you have already allocated some memory to Java by running:
#>   options(java.parameters = '-Xmx2G').
#> You should replace '2G' by the amount of memory you'll require. Currently, Java memory is set to
library(accessibility)
library(data.table)

path <- system.file("extdata/poa", package = "r5r")

r5r_core <- setup_r5(path, verbose = FALSE)
#> Using cached R5 version from /home/dhersz/R/x86_64-pc-linux-gnu-library/4.2/r5r/jar/r5-v6.7-all.jar
#> 
#> Using cached network.dat from /home/dhersz/R/x86_64-pc-linux-gnu-library/4.2/r5r/extdata/poa/network.dat

points <- fread(file.path(path, "poa_hexgrid.csv"))

ttm <- travel_time_matrix(
  r5r_core,
  origins = points,
  destinations = points,
  mode = c("WALK", "TRANSIT"),
  departure_datetime = as.POSIXct(
    "13-05-2019 14:00:00",
    format = "%d-%m-%Y %H:%M:%S"
  ),
  max_walk_dist = 800,
  max_trip_duration = 120,
  verbose = FALSE,
  progress = FALSE
)

min_cost <- cost_to_closest(
  ttm,
  points,
  opportunity = "schools",
  travel_cost = "travel_time_p50"
)
#> Warning in `[.data.table`(filled_access_df, is.na(get(access_col)),
#> `:=`(eval(access_col, : inf (type 'double') at RHS position 1 truncated
#> (precision lost) when assigning to type 'integer' (column 2 named 'min_cost')

min_cost
#>                    id travel_time_p50
#>    1: 89a9012124fffff               0
#>    2: 89a9012126bffff              16
#>    3: 89a9012127bffff              14
#>    4: 89a90128003ffff               7
#>    5: 89a90128007ffff              16
#>   ---                                
#> 1218: 89a90e934cbffff              13
#> 1219: 89a90e934cfffff               9
#> 1220: 89a90e934d3ffff               7
#> 1221: 89a90e934d7ffff               0
#> 1222: 89a90e934dbffff              23

Created on 2022-09-23 by the reprex package (v2.0.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions