Skip to content

Commit

Permalink
Output Data
Browse files Browse the repository at this point in the history
Output data from resulting search for the user in their global environment.
  • Loading branch information
kurtawirth committed Nov 6, 2018
1 parent 62c2a76 commit 2877249
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: botscan
Type: Package
Title: Scans Twitter Conversations For Bots
Version: 1.0.5
Version: 1.0.6
Author: Kurt Wirth and Ryan T. Moore
Maintainer: Kurt Wirth <KurtAWirth@gmail.com>
Description: This package accepts any Twitter search query as an input and
Expand Down
10 changes: 9 additions & 1 deletion R/botscan.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,15 @@
botscan <- function(x, timeout = 30, n_tweets = 1000, retweets = FALSE, threshold = 0.899,
user_level = FALSE, search = FALSE, parse = TRUE, verbose = TRUE) {

# If "search" is TRUE, then use Twitter's Search API

if(search) {

tweets <- rtweet::search_tweets(x, n = n_tweets, include_rts = retweets)

} else {
# If "search" if FALSE (default), then use Twitter's Streaming API

} else {

tweets <- rtweet::stream_tweets(x, timeout = timeout, parse = parse)

Expand Down Expand Up @@ -92,6 +96,10 @@ botscan <- function(x, timeout = 30, n_tweets = 1000, retweets = FALSE, threshol

}

# Assign resulting dataframe to global environment

assign("df", df_userbots, envir=globalenv())

# Check scores against given threshold

nbots <- sum(df_userbots$cap.universal > threshold)
Expand Down

0 comments on commit 2877249

Please sign in to comment.