plot_topic_share_per_period: Topic share per period stacked area chart

plot_topic_share_per_periodR Documentation

Topic share per period stacked area chart

Description

Creates a Plotly stacked area chart that visualizes the share of referendum topic occurences per period.

Usage

plot_topic_share_per_period(
  data,
  tier = 1L,
  period = c("week", "month", "quarter", "year", "decade", "century"),
  weight_by_n_rfrnds = TRUE
)

Arguments

data

RDB referendum data as returned by rfrnds(). A data frame that at minimum contains the column topics_tier_# of the specified tier.

tier

Tier of the topics variable to plot. 1L, 2L or 3L.

period

Type of period to count topics by. One of "week", "month", "quarter", "year", "decade" or "century".

weight_by_n_rfrnds

Whether or not to weight topic occurences by number of referendums. If TRUE, for a referendum with n different topics of the same tier, every topic is counted 1/n.

Details

Note that the period types "year", "decade" and "century" are unique timespans, while "week", "month" and "quarter" are recurring timespans (e.g. every year has a week 1).

Value

A plotly object.

See Also

Other visualization functions: ggplot_streamgraph(), plot_rfrnd_share_per_period(), plot_topic_segmentation()

Examples

rdb::rfrnds(quiet = TRUE) |>
  rdb::plot_topic_share_per_period(period = "decade")

zdaarau/c2d documentation built on Dec. 18, 2024, 1:24 p.m.