setup

## set up search terms
searchString.x <- "#TrumpWon"    # search term
n.x <- 3000                     # number of tweets
radius <- "30mi"               # radius around selected geo-location
duration.days <- 1             # how many days
since.date <- (Sys.Date() - duration.days) %>% as.character # calculated starting date

#TrumpWon geo-preference.

[1] "Using direct authentication"

Get city geo data from maps::cities

Use the twitteR::searchTwitter command.

n.cities <- 40

Data collection for the top 40 cities (by population) in the U.S. This includes cities from New York to Nashville.

Tweet-Map for #TrumpWon?

map.plot +
    geom_point(aes(x = lon, y = lat, fill = tweet.flux, size = n.tweets), data=analyzed_df, pch=21, color = "#33333399") +
    ggtitle(paste0(searchString.x, " tweets in ", duration.days," days since ", since.date, " r = ", radius)) +
    scale_fill_gradient(low = "#BBBBFF", high = "#EE3300", space = "Lab", na.value = "grey50", guide = "colourbar")

#TrumpWon AMB tweet-flux

Here are the top few cities by tweet flux (in “twipermipeds”).

name tweet.flux n.tweets population
Nashville 1002.54 1835 1830345
Sacramento 394.87 898 2274194
Washington 257.47 1570 6097684
Cincinnati 178.89 386 2157719
Las Vegas 175.90 372 2114801
Miami 160.84 967 6012331
New York 148.65 3000 20182305
Atlanta 100.16 572 5710795
San Francisco 86.55 403 4656132
Dallas 78.14 555 7102796
Detroit 70.43 303 4302043
Austin 66.97 134 2000860
Los Angeles 52.70 703 13340068
Seattle 50.35 188 3733580
Boston 49.22 235 4774321

#TrumpWon AMB tweet count

Here are the top few cities sorted by raw tweets, again with major metro areas leading. Note that some other cities, like Chicago, have a large number of tweets but a lower flux because of their higher population.

name tweet.flux n.tweets population
New York 148.65 3000 20182305
Nashville 1002.54 1835 1830345
Washington 257.47 1570 6097684
Miami 160.84 967 6012331
Sacramento 394.87 898 2274194
Los Angeles 52.70 703 13340068
Atlanta 100.16 572 5710795
Dallas 78.14 555 7102796
San Francisco 86.55 403 4656132
Cincinnati 178.89 386 2157719
Las Vegas 175.90 372 2114801
Detroit 70.43 303 4302043
Boston 49.22 235 4774321
Chicago 22.82 218 9551031
Seattle 50.35 188 3733580