1search_twitter_and_store = function(searchString, table_name="tweets", lang=NULL, 2 locale=NULL, geocode=NULL, retryOnRateLimit=120, ...) { 3 if (table_exists(table_name)) { 4 since_id = get_latest_tweet_id(table_name) 5 } else { 6 since_id = NULL 7 } 8 9 new_tweets = suppressWarnings(searchTwitter(searchString, n=5000, sinceID=since_id, lang=lang, 10 locale=locale, retryOnRateLimit=retryOnRateLimit, ...)) 11 if (length(new_tweets) > 0) { 12 store_tweets_db(new_tweets, table_name) 13 } 14 15 length(new_tweets) 16}