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

Need to ask to print travel_time_matrix result twice to actually print it #59

Closed
dhersz opened this issue Aug 21, 2020 · 2 comments
Closed

Comments

@dhersz
Copy link
Member

dhersz commented Aug 21, 2020

The title is confusing, but I don't really know how to express that in words in a more clearer way.
Everytime I run travel_time_matrix example I can't print it the first time I try to. See example below (note the df typed twice):

# build transport network
path <- system.file("extdata", package = "r5r")
r5r_obj <- setup_r5(data_path = path)

# load origin/destination points
points <- read.csv(system.file("extdata/poa_hexgrid.csv", package = "r5r"))[1:5,]

# estimate travel time matrix
df <- travel_time_matrix( r5r_obj,
                          origins = points,
                          destinations = points,
                          departure_datetime = as.POSIXct("13-03-2019 14:00:00",
                                               format = "%d-%m-%Y %H:%M:%S"),
                          mode = c('WALK', 'TRANSIT'),
                          max_walk_dist = 5,
                          max_trip_duration = 7200
                          )
> df
> df
             fromId   fromLat   fromLon            toId     toLat     toLon travel_time
 1: 89a901291abffff -30.05385 -51.15825 89a901291abffff -30.05385 -51.15825           2
 2: 89a901291abffff -30.05385 -51.15825 89a901295b7ffff -30.07544 -51.16521          54
 3: 89a901291abffff -30.05385 -51.15825 89a901284a3ffff -30.09005 -51.20535         117
 4: 89a901291abffff -30.05385 -51.15825 89a9012809bffff -30.07839 -51.19575          80
 5: 89a9012a3cfffff -30.10058 -51.21187 89a9012a3cfffff -30.10058 -51.21187           3
 6: 89a9012a3cfffff -30.10058 -51.21187 89a901284a3ffff -30.09005 -51.20535          58
 7: 89a9012a3cfffff -30.10058 -51.21187 89a9012809bffff -30.07839 -51.19575         112
 8: 89a901295b7ffff -30.07544 -51.16521 89a901291abffff -30.05385 -51.15825          54
 9: 89a901295b7ffff -30.07544 -51.16521 89a901295b7ffff -30.07544 -51.16521           0
10: 89a901295b7ffff -30.07544 -51.16521 89a901284a3ffff -30.09005 -51.20535         117
11: 89a901295b7ffff -30.07544 -51.16521 89a9012809bffff -30.07839 -51.19575          61
12: 89a901284a3ffff -30.09005 -51.20535 89a9012a3cfffff -30.10058 -51.21187          58
13: 89a901284a3ffff -30.09005 -51.20535 89a901284a3ffff -30.09005 -51.20535           2
14: 89a901284a3ffff -30.09005 -51.20535 89a9012809bffff -30.07839 -51.19575          45
15: 89a9012809bffff -30.07839 -51.19575 89a9012a3cfffff -30.10058 -51.21187          87
16: 89a9012809bffff -30.07839 -51.19575 89a901295b7ffff -30.07544 -51.16521          61
17: 89a9012809bffff -30.07839 -51.19575 89a901284a3ffff -30.09005 -51.20535          46
18: 89a9012809bffff -30.07839 -51.19575 89a9012809bffff -30.07839 -51.19575           0
                                                                   mode
 1: WALK TRANSIT;TRAM;SUBWAY;RAIL;BUS;FERRY;CABLE_CAR;GONDOLA;FUNICULAR
 2: WALK TRANSIT;TRAM;SUBWAY;RAIL;BUS;FERRY;CABLE_CAR;GONDOLA;FUNICULAR
 3: WALK TRANSIT;TRAM;SUBWAY;RAIL;BUS;FERRY;CABLE_CAR;GONDOLA;FUNICULAR
 4: WALK TRANSIT;TRAM;SUBWAY;RAIL;BUS;FERRY;CABLE_CAR;GONDOLA;FUNICULAR
 5: WALK TRANSIT;TRAM;SUBWAY;RAIL;BUS;FERRY;CABLE_CAR;GONDOLA;FUNICULAR
 6: WALK TRANSIT;TRAM;SUBWAY;RAIL;BUS;FERRY;CABLE_CAR;GONDOLA;FUNICULAR
 7: WALK TRANSIT;TRAM;SUBWAY;RAIL;BUS;FERRY;CABLE_CAR;GONDOLA;FUNICULAR
 8: WALK TRANSIT;TRAM;SUBWAY;RAIL;BUS;FERRY;CABLE_CAR;GONDOLA;FUNICULAR
 9: WALK TRANSIT;TRAM;SUBWAY;RAIL;BUS;FERRY;CABLE_CAR;GONDOLA;FUNICULAR
10: WALK TRANSIT;TRAM;SUBWAY;RAIL;BUS;FERRY;CABLE_CAR;GONDOLA;FUNICULAR
11: WALK TRANSIT;TRAM;SUBWAY;RAIL;BUS;FERRY;CABLE_CAR;GONDOLA;FUNICULAR
12: WALK TRANSIT;TRAM;SUBWAY;RAIL;BUS;FERRY;CABLE_CAR;GONDOLA;FUNICULAR
13: WALK TRANSIT;TRAM;SUBWAY;RAIL;BUS;FERRY;CABLE_CAR;GONDOLA;FUNICULAR
14: WALK TRANSIT;TRAM;SUBWAY;RAIL;BUS;FERRY;CABLE_CAR;GONDOLA;FUNICULAR
15: WALK TRANSIT;TRAM;SUBWAY;RAIL;BUS;FERRY;CABLE_CAR;GONDOLA;FUNICULAR
16: WALK TRANSIT;TRAM;SUBWAY;RAIL;BUS;FERRY;CABLE_CAR;GONDOLA;FUNICULAR
17: WALK TRANSIT;TRAM;SUBWAY;RAIL;BUS;FERRY;CABLE_CAR;GONDOLA;FUNICULAR
18: WALK TRANSIT;TRAM;SUBWAY;RAIL;BUS;FERRY;CABLE_CAR;GONDOLA;FUNICULAR
@mvpsaraiva
Copy link
Collaborator

This happens to me as well. I guess it's some sort of data.table optimisation for large data frames, some 'lazy loading' of sorts. What do you think, @rafapereirabr?

@rafapereirabr
Copy link
Member

This happens to me as well. I guess it's some sort of data.table optimisation for large data frames, some 'lazy loading' of sorts. What do you think, @rafapereirabr?

Yep. This shouldn't be a problem.

@dhersz dhersz closed this as completed Aug 21, 2020
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

3 participants