Usage
stream_tweets(q = "", timeout = 30, parse = TRUE, clean_tweets = TRUE, as_double = FALSE, token = NULL, file_name = NULL, gzip = FALSE, verbose = TRUE, ...)
Arguments
q
Character vector with desired phrases and keywords
used to filter tweets, a comma separated list of desired
user IDs to track, or a set of bounding boxes to track. If
left empty, the default q = ""
, stream function will
return sample of all tweets.
timeout
Numeric scalar specifying amount of time, in seconds,
to leave connection open while streaming/capturing tweets.
By default, this is set to 30 seconds. To stream indefinitely,
use timeout = FALSE
to ensure json file is not deleted
upon completion or timeout = Inf
.
parse
Logical, indicating whether to return parsed data.
By default, parse = TRUE
, this function does the parsing for
you. However, for larger streams, or for automated scripts designed
to continuously collect data, this should be set to false as the
parsing process can eat up processing resources and time. For other
uses, setting parse to TRUE saves you from having to sort and parse
the messy list structure returned by Twitter. (Note: if you set parse
to false, you can use the parse_stream
function to
parse the json file at a later point in time.) clean_tweets
logical indicating whether to remove non-ASCII
characters in text of tweets. defaults to TRUE.
as_double
logical indicating whether to handle ID variables
as double (numeric) class. By default, this is set to FALSE, meaning
ID variables are treated as character vectors. Setting this to
TRUE can provide performance (speed and memory) boost but can also
lead to issues when printing and saving, depending on the format.
token
OAuth token. By default token = NULL
fetches a
non-exhausted token from an environment variable. Find instructions
on how to create tokens and setup an environment variable in the
tokens vignette (in r, send ?tokens
to console).
file_name
Character with name of file. By default, a temporary
file is created, tweets are parsed and returned to parent environment,
and the temporary file is deleted.
gzip
Logical indicating whether to request gzip compressed
stream data. By default this is set to FALSE. After performing some
tests, it appears gzip requires less bandwidth, but also returns
slightly fewer tweets. Use of gzip option should, in theory, make
connection more reliable (by hogging less bandwidth, there's less of
a chance Twitter cuts you off for getting behind).
verbose
Logical, indicating whether or not to include output
processing/retrieval messages.
...
Insert magical paramaters, spell, or potion here.