i have missing latitude and longitude and I need to compute the latitude and longitude from location variable but this doesn't work
the code work if I don't apply the geocode function but doesn't work with the function
can somebody help me?
us_mass_shooting_data %>% mutate(
Latitude = ifelse(
is.na(Latitude), geocode(Location)$lat, Latitude),
Longitude = ifelse(
is.na(Longitude), geocode(Location)$lon, Longitude
)
)