I have a data frame of Flickr photos with geo information (lat and long). The photos are dust storm photos and I’m trying to use these data to study the occurrence of duststorms in the US.
With the long and lat info, I’m trying to determine the state in which these pictures were taken and the state information add it as a new column to the data and i got this error message
My data is available in this google link here https://drive.google.com/file/d/1uCbFL6tmS_JgxnahB_c4ul9pG_PDLZyS/view?usp=sharing
Error message
Error in mutate()
:
ℹ In argument: state = mapply(get_state, latitude, longitude)
.
Caused by error in match.arg()
:
! 'arg' should be one of “address”, “all”
I’d like to know how I can troubleshoot this or if there are other ways of achieving my goal.
Here is my code ------
library(ggmap)
library(dplyr)
get_state <- function(lat, lon) {
location <- revgeocode(c(lon, lat), output = "more")
state <- location$administrative_area_level_1
return(state)
}
photos <- photos %>%
mutate(state = mapply(get_state, latitude, longitude))