plot_rfrnd_share_per_period: Referendum share per period stacked area chart

plot_rfrnd_share_per_periodR Documentation

Referendum share per period stacked area chart

Description

Creates a Plotly stacked area chart that visualizes the share of referendums per period, grouped by another column.

Usage

plot_rfrnd_share_per_period(
  data,
  by,
  period = c("week", "month", "quarter", "year", "decade", "century")
)

Arguments

data

RDB referendum data as returned by rfrnds(). A data frame that at minimum contains the column specified in period or the column date (to compute the period column), plus the column specified in by.

by

data column to group by before counting number of referendums. Tidy selections are supported.

period

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

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_topic_segmentation(), plot_topic_share_per_period()

Examples

rdb::rfrnds(quiet = TRUE,
            max_cache_age = "1 year") |>
  rdb::plot_rfrnd_share_per_period(by = "level")

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