create_map: Plot the map report on the episomer dashboard

View source: R/dataviz.R

create_mapR Documentation

Plot the map report on the episomer dashboard

Description

Generates a bubble map plot of number of posts by country for a single topic

Usage

create_map(
  sms,
  topic = c(),
  countries = c(1),
  date_min = "1900-01-01",
  date_max = "2100-01-01",
  with_quotes = FALSE,
  caption = "",
  proj = NULL,
  forplotly = FALSE
)

Arguments

sms

Social media

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_quotes

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

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, default NULL If null and all countries are selected +proj=robin is used (Robinson projection) otherwise the Lambert azimuthal equal-area projection will be chosen, default: NULL

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 posts 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 post within the period which could be any administrative level or city level.

Posts 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

## Not run: 
   #Getting bubble chart for dengue for South America for last 30 days
   message('Please choose the episomer 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())
   )

## End(Not run)

episomer documentation built on Nov. 26, 2026, 5:07 p.m.