This function creates a decade-based frequency count of shows for each city, and joins this information with geocoded city data.
Examples
unique_shows <- data.frame(
showID = 1:5,
city = c("New York", "London", "Paris", "New York", "Tokyo"),
country = c("USA", "UK", "France", "USA", "Japan"),
date = as.Date(c("1990-01-01", "2000-01-01", "2010-01-01", "1995-01-01", "2020-01-01"))
)
geocoded_cities <- data.frame(
city = c("New York", "London", "Paris", "Tokyo"),
country = c("USA", "UK", "France", "Japan"),
lat = c(40.7128, 51.5074, 48.8566, 35.6762),
lon = c(-74.0060, -0.1278, 2.3522, 139.6503)
)
decade_frequency <- create_decade_frequency(unique_shows, geocoded_cities)