Description Usage Arguments Author(s) Examples
count.tweets
opens a connection to the Mongo database in
the lab computer and will return the number of tweets that match a series of
conditions: whether it contains a certain keyword, whether it is or not a retweet,
or whether or not it contains a hashtag.
1 2 3 |
set |
string, name of the collection of tweets in the Mongo database to query. |
string |
string or vector of strings, set to NULL by default (will return count of all tweets). If it is a string, it will return the number of tweets that contain that string. If it is a vector of string, it will return all tweets that contain at least one of them. |
retweets |
logical, set to NULL by default (will return count of all tweets).
If |
hashtags |
logical, set to NULL by default (will return count of all tweets).
If |
from |
date, in string format. If different from |
to |
date, in string format. If different from |
user_id |
numeric ID of a user. If different form |
screen_name |
screen name of a user. If different form |
verbose |
logical, default is |
Pablo Barbera pablo.barbera@nyu.edu
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## Not run:
## connect to the Mongo database
mongo <- mongo.create("SMAPP_HOST:PORT", db="DATABASE")
mongo.authenticate(mongo, username="USERNAME", password="PASSWORD", db="DATABASE")
set <- "DATABASE.COLLECTION"
## count all tweets in the database
count.tweets(set)
## count tweets that mention the word 'turkey'
count.tweets(set, string="turkey")
## count tweets that mention the words 'turkey' and 'gezi'
count.tweets(set, string=c("turkey", "gezi"))
## count all retweets in the database
count.tweets(set, retweets=TRUE)
## count all tweets that mention 'turkey' and are not retweets
count.tweets(set, string="turkey", retweets=FALSE)
## count all tweets that use a hashtag
count.tweets(set, hashtags=TRUE)
## count all tweets from January 1st to January 15th
count.tweets(set, from="2014-01-01 00:00:00", to="2014-01-15 23:59:59")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.