Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning in cost_to_closest() #27

Closed
dhersz opened this issue Sep 23, 2022 · 1 comment
Closed

Warning in cost_to_closest() #27

dhersz opened this issue Sep 23, 2022 · 1 comment

Comments

@dhersz
Copy link
Contributor

dhersz commented Sep 23, 2022

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)

@dhersz
Copy link
Contributor Author

dhersz commented Oct 6, 2022

Fixed in dc65f17.

@dhersz dhersz closed this as completed Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant