How can I delay the execution of a function within the purrr function

Viewed 426

Executing the following code using the purrr::map_dfr() function sometimes limits the number of API times per second.

data.frame(location = c("sapporo", "aomori", "sendai", "morioka", "yamagata", "iwate")) %>%
  purrr::map_dfr(.f = function(x) ggmap::geocode(as.character(x)))

Warning message: geocode failed with status OVER_QUERY_LIMIT, location = "aomori"

I'd like to put something like sys.sleep (1), but how do I do it?

1 Answers
Related