This function creates frequency counts for cities based on unique shows and joins the result with geocoded city data.
Examples
unique_shows <- data.frame(
showID = 1:3,
city = c("New York", "London", "New York"),
country = c("USA", "UK", "USA"),
date = as.Date(c("2023-01-01", "2023-02-01", "2023-03-01")),
venue = c("Madison Square Garden", "Wembley Stadium", "Yankee Stadium"),
tour = c("Tour A", "Tour B", "Tour A")
)
geocoded_cities <- data.frame(
city = c("New York", "London"),
country = c("USA", "UK"),
lat = c(40.7128, 51.5074),
lon = c(-74.0060, -0.1278)
)
city_freq <- create_city_frequency(unique_shows, geocoded_cities)