track_twitter_hashtag: track_twitter_hashtag

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Provide a scatterplot displaying hashtag counts overtime based on data obtained from Twitter.

Usage

1
track_twitter_hashtag(keyword, type, number, sincetype, provideN)

Arguments

keyword

A character vector of maximum length 4 (keywords requested)

type

A character vector of length 1 (type of keyword, can be either a city/place/monument name in English, to be referred to as "place", or if needed another type of keyword, please specify by "other").
Note: all keywords should be of the same types (e.g. all places' names).

number

A positive integer number (timeframe parameter)

sincetype

A character vector of length 1 (timeframe parameter), which can be (uniquely) on of the following: either "days", "weeks", "months" or "years"

provideN

A positive integer number (Number ot tweets to fetch per keywords)

Details

The function automatically obtains the latitude and longitude of each requested place, then queries the Twitter API to obtain the number of tweets with the requested # keywords for the desired timeframe, and returns at the end a scatterplot based on the aesthetics of ggplot2, allowing thus to analyze which places are the most popular over a given time period.
It should be noted in that sense that if the time frame selected by the user is less than or equal to 2 weeks, the plot returned groups data by hour, whereas if the user requests longer timeframes the result will be grouped by days for better representation of the changes over time (short/long term).

Lastly, we advise the user to keep the parameter provideN low to avoid long delay responses from Twitter API (e.g. setting provideN=100 would be preferable than 1000).

Value

A timeseries scatterplot with the hashtag count on the y axis, and on the x axis the timeframe.

A dataframe containing all the results fetched from Twitter (e.g. tweets) based on package twitteR

Author(s)

Ayrton Rua: ayrton.gomesmartinsrua@unil.ch

Maurizio Griffo: maurizio.griffo@unil.ch

Ali Karray: mohamedali.karray@unil.ch

Mohit Mehrotra: mohit.mehrotra@unil.ch

Youness Zarhloul: youness.zarhloul@unil.ch

References

Orso, S., Molinari, R., Lee, J., Guerrier, S., & Beckman, M. (2018). An Introduction to Statistical Programming Methods with R. Retrieved from https://smac-group.github.io/ds/

See Also

touristR & run_shiny

Examples

1
2
3
4
5
6
7
8
9
## Not run: track_keyword(
keyword = c("eiffel tower", "san francisco", "london"),
type="place",
number = 2,
sincetype = "weeks",
provideN = 100
)

## End(Not run)

AyrtonRua/group1_project documentation built on May 14, 2019, 5:14 a.m.