% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/search-tweets.R
\name{searchTweets}
\alias{searchTweets}
\title{Search recent tweets}
\usage{
searchTweets(q, filename, n = 200, oauth_folder = "~/credentials",
  until = NULL, since_id = NULL, result_type = "recent", lang = NULL,
  sleep = 0.5, verbose = FALSE)
}
\arguments{
\item{q}{search query to issue to Twitter. It can contain Boolean operators.}

\item{filename}{file where tweets will be stored (in json format)}

\item{n}{maximum number of tweets to be downloaded}

\item{oauth_folder}{folder where OAuth tokens are stored.}

\item{until}{limit for the most recent tweet. The function will then
returns tweets created before this date. Date should be formatted as
YYYY-MM-DD. Keep in mind that the search index has a 7-day limit}

\item{since_id}{id of the oldest tweet to be downloaded. Useful if, for
example, we're only interested in getting tweets sent after a certain
date.}

\item{result_type}{specifies the type of results you would prefer to
receive: "recent" (default), "popular" or "mixed".}

\item{lang}{restricts tweets to the given language (e.g. "es")}

\item{sleep}{numeric, number of seconds between API calls. Higher number
will increase reliability of API calls; lower number will increase speed.}

\item{verbose}{If TRUE, provides additional output in console about API
rate limits}
}
\description{
\code{searchTweets} connects to the REST API of Twitter and returns
recent tweets (usually no more than 5-7 days old) based on a supplied
search string. Note that this function will not return all tweets. As
explained in the documentation (\url{https://dev.twitter.com/rest/public/search}),
the goal of this API endpoint is relevance and not completeness.
}
\examples{
\dontrun{
## Download recent tweets by user "p_barbera"
 searchTweets(q="twitter", filename="twitter-tweets.json",
   n=200, oauth_folder="oauth")
}
}
\author{
Pablo Barbera \email{pablo.barbera@nyu.edu}
}

