- 
      
 - 
        
Save naupaka/c26f61457b942e313179e835547c8dcf to your computer and use it in GitHub Desktop.  
    A visit to Durham
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | library(rtweet) #rtweet API creds should already be set up | |
| library(stringi) | |
| library(dplyr) | |
| friends = get_friends(user="noamross") | |
| followers = get_followers("noamross") | |
| tweeps_id = distinct(bind_rows(friends, followers)) | |
| tweeps_info = lookup_users(tweeps_id$user_id) | |
| # A regex for a visit to Durham | |
| nc_regex = "(\\bNC\\b|North Carolina|Durham|Raleigh|\\bUNC\\b|University of North Carolina|Chapel Hill|\\bDuke\\b|\\,\\sNC\\b)" | |
| 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