Skip to content

Instantly share code, notes, and snippets.

@stephlocke
Forked from noamross/find_local_tweeps.R
Last active February 19, 2019 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save stephlocke/fd8de6d6a1206dec900e1d78b61226c6 to your computer and use it in GitHub Desktop.
Save stephlocke/fd8de6d6a1206dec900e1d78b61226c6 to your computer and use it in GitHub Desktop.
A visit to Durham
library(rtweet) #rtweet API creds should already be set up
library(stringi)
library(dplyr)
friends = get_friends(user="stephlocke")
followers = get_followers("stephlocke")
tweeps_id = distinct(bind_rows(friends, followers))
tweeps_info = lookup_users(tweeps_id$user_id)
# A regex for a visit to Durham
nc_regex = "(Dublin|dublin)"
nc_tweeps_info = tweeps_info %>%
filter(stri_detect_regex(paste(name, screen_name, location, description),
nc_regex, case_insensitive=TRUE))
nc_tweeps_info %>%
dplyr::select(name, screen_name, description, location) %>%
arrange(location)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment