create_map {epitweetr} | R Documentation |
Plot the map report on the epitweetr dashboard
Description
Generates a bubble map plot of number of tweets by countries, for one topic
Usage
create_map(
topic = c(),
countries = c(1),
date_min = "1900-01-01",
date_max = "2100-01-01",
with_retweets = FALSE,
location_type = "tweet",
caption = "",
proj = NULL,
forplotly = FALSE
)
Arguments
topic |
Character(1) containing the topic to use for the report |
countries |
Character vector containing the name of the countries and regions to plot or their respective indexes on the Shiny app, default: c(1) |
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) vector indicating the location type. Possible values 'tweet', 'user' or 'both', default: 'tweet' |
caption |
Character(1) vector indicating a caption to print at the bottom of the chart, default: "" |
proj |
Parameter indicating the CRS (Coordinate Reference System) to use on PROJ4 format |
forplotly |
Logical(1) parameter indicating whether some hacks are activated to improve plotly rendering, default: FALSE |
Details
Produces a bubble chart map for a particular topic on number of tweets collected based on the provided parameters. The map will display information at country level if more than one country is selected, otherwise it will display bubbles at the smallest possible location identified for each tweet within the period which could be any administrative level or city level.
Tweets associated with a country but with no finer granularity are omitted when displaying a single country.
When an aggregated zone is requested, all countries in that zone are included.
This functions 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 dataframe that was used to build the map.
See Also
trend_line
create_topwords
detect_loop
search_loop
spTransform
,coordinates
,is.projected
,CRS-class
fortify
,geom_polygon
,geom_point
Examples
if(FALSE){
#Getting bubble chart for dengue for South America for last 30 days
message('Please choose the epitweetr data directory')
setup_config(file.choose())
create_map(
topic = "dengue",
countries = "South America",
date_min = as.Date(Sys.time())-30,
date_max=as.Date(Sys.time())
)
}