create_topwords {epitweetr}R Documentation

Plot the top words report on the epitweetr dashboard

Description

Generates a bar plot of most popular words in tweets, for one topic

Usage

create_topwords(
  topic,
  country_codes = c(),
  date_min = "1900-01-01",
  date_max = "2100-01-01",
  with_retweets = FALSE,
  location_type = "tweet",
  top = 25
)

Arguments

topic

Character(1) containing the topic to use for the report

country_codes

Character vector containing the ISO 3166-1 alpha-2 countries to plot, default: c()

date_min

Date indicating start of the reporting period, default: "1900-01-01"

date_max

Date indicating end of the reporting period, default: "2100-01-01"

with_retweets

Logical value indicating whether to include retweets in the time series, default: FALSE

location_type

Character(1) this parameter is currently being IGNORED since this report shows only tweet location and cannot show user or both locations for performance reasons, default: 'tweet'

top

numeric(1) Parameter indicating the number of words to show, default: 25

Details

Produces a bar chart showing the occurrences of the most popular words in the collected tweets based on the provided parameters. For performance reasons on tweet aggregation this report only shows tweet location and ignores the location_type parameter

This report may be empty for combinations of countries and topics with very few tweets since for performance reasons, the calculation of top words is an approximation using chunks of 10.000 tweets.

This function requires that search_loop and detect_loop have already been run successfully to show results.

Value

A named list containing two elements: 'chart' with the ggplot2 figure and 'data' containing the data frame that was used to build the map.

See Also

trend_line create_map detect_loop search_loop

Examples

if(FALSE){
   message('Please choose the epitweetr data directory')
   setup_config(file.choose())
   #Getting topword chart for dengue for France, Chile, Australia for last 30 days
   create_topwords(
     topic = "dengue", 
     country_codes = c("FR", "CL", "AU"),
     date_min = as.Date(Sys.time())-30, 
     date_max=as.Date(Sys.time())
   ) 
 }

[Package epitweetr version 2.2.16 Index]