Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
391 views
in Technique[技术] by (71.8m points)

r - Error using ggmap mapdist() and write back to tibble

Trying to get with a batch some routedistances with mapdist. In the Variable "von" are my adresses.

gtib = mapdist(from=von, to=nach, mode='transit', output='simple') 

and write it back to a tibble-table (if it would be a dataframe it is also ok).

Tried with 10 addresses and it worked fine. The output is a tibble. When I would like to pass my hole list of addresses then it stucks. Do not have experience with tibbles and I don't understand the error-messages (see below). I guess there is some problem with some addresses, maybe Google can not find and tibble has a problem with that with its matrixsize?

This is one example before I get the error: Source : https://maps.googleapis.com/maps/api/distancematrix/json?origins=Z%C3%BCrchese+9,+H%C3%BCton&destinations=Z%C3%BCrich+HB&key=xxx&mode=transit

Fehler: Can't recycle `..1` (size 266) to match `..2` (size 253).
Run `rlang::last_error()` to see where the error occurred.
> rlang:last_error()
Fehler: Objekt 'rlang' nicht gefunden
> rlang::last_error()
<error/vctrs_error_incompatible_size>
Can't recycle `..1` (size 266) to match `..2` (size 253).
Backtrace:
 1. ggmap::mapdist(from = von, to = nach, mode = "transit", output = "simple")
 6. vctrs::stop_incompatible_size(...)
 7. vctrs:::stop_incompatible(...)
 8. vctrs:::stop_vctrs(...)
Run `rlang::last_trace()` to see the full context.
> rlang::last_trace()
<error/vctrs_error_incompatible_size>
Can't recycle `..1` (size 266) to match `..2` (size 253).
Backtrace:
    x
 1. +-ggmap::mapdist(from = von, to = nach, mode = "transit", output = "simple")
 2. | -`%>%`(...)
 3. +-dplyr::mutate(., mode = mode)
 4. +-dplyr::bind_cols(from_to_df, .)
 5. | -vctrs::vec_cbind(!!!dots, .name_repair = .name_repair)
 6. -vctrs::stop_incompatible_size(...)
 7.   -vctrs:::stop_incompatible(...)
 8.     -vctrs:::stop_vctrs(...)
question from:https://stackoverflow.com/questions/65845019/error-using-ggmap-mapdist-and-write-back-to-tibble

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...