-
Notifications
You must be signed in to change notification settings - Fork 26
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
detailed_itineraires for multiple origins #224
Comments
hi
you have 2 solutions at least
1. use foreach or map or apply or assign to a list to list your output
2. pass to detailled_itirenaries a cross product of origins and
destinations in a long form (one pair of o and d per row)
2 may be more efficient 1 can be run using parallel stuff
Le ven. 4 févr. 2022 à 03:06, franciscopasqual ***@***.***> a
écrit :
… The detailed_itineraires function works only for one single origin at a
time, and I need to obtain results (actually just the distances) for a
large number of origins. I wasn't successful on automating the function
using "for", because at every new loop the output overwrites the last
one... Any suggestions on how can I change the "det" for every new loop?
for (i in 1:10) {
det <- detailed_itineraries(r5r_core = r5r_core,
origins = origins[i,],
destinations = destinations,
mode = mode,
departure_datetime = departure_datetime,
max_walk_dist = max_walk_dist,
max_trip_duration = max_trip_duration,
shortest_path = FALSE)
}
—
Reply to this email directly, view it on GitHub
<#224>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANA2KEMBZ5LS6J2BXK4MICLUZMYD5ANCNFSM5NQSA3KA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Thanks @xtimbeau for helping out. I definitely suggest using solution 2... do a cross product of origins and destinations, and let r5r run it all in parallel. You can use the function @rafapereirabr suggested in issue #61 to do that. |
Thanks for the suggestions! I managed to create the cross product of all pairs but still don't know how to use that to run detailed_itineraires function, since it asks for different origins and destinations files. det <- detailed_itineraries(r5r_core = r5r_core, |
please follow the example below:
|
This worked out perfectly! I didn't realize that the function works for multiple origins at a time if you organize them that way. Thanks a lot @rafapereirabr! |
Is there any way to make your approach work with different departure times for each OD pair, @rafapereirabr, or do I have to do a loop? |
Hi @Torskelgen. Currently, it's not possible. This is a good idea, and it's relatively simple to implement. We'll add this feature in the next release of the package. |
That would be really neat. Thank you for your really great work with this package! |
The dev version of the |
The detailed_itineraires function works only for one single origin at a time, and I need to obtain results (actually just the distances) for a large number of origins. I wasn't successful on automating the function using "for", because at every new loop the output overwrites the last one... Any suggestions on how can I change the "det" for every new loop?
for (i in 1:10) {
det <- detailed_itineraries(r5r_core = r5r_core,
origins = origins[i,],
destinations = destinations,
mode = mode,
departure_datetime = departure_datetime,
max_walk_dist = max_walk_dist,
max_trip_duration = max_trip_duration,
shortest_path = FALSE)
}
The text was updated successfully, but these errors were encountered: