tbl_n_rfrnds_per_period | R Documentation |
Creates a ready-to-print gt table with the number of referendums per period, optionally counted by
up to two additional columns.
tbl_n_rfrnds_per_period(
data,
by = NULL,
period = c("week", "month", "quarter", "year", "decade", "century"),
fill_gaps = TRUE,
period_floor = NULL,
period_ceiling = NULL,
squeeze_zero_rows = TRUE,
descending = TRUE,
add_total_row = TRUE,
add_total_col = NULL,
lbl_total_row = gt::md("**Total**"),
lbl_total_col = lbl_total_row
)
data |
RDB referendum data as returned by |
by |
Up to two additional |
period |
Type of period to count referendums by. One of
|
fill_gaps |
Whether or not to add zero-value rows to the result for |
period_floor |
Lower |
period_ceiling |
Upper |
squeeze_zero_rows |
Whether or not to compress consecutive zero-sum rows into single period span rows. |
descending |
Whether to sort the resulting table by |
add_total_row |
Whether or not to add a summary row at the very end of the table containing column totals. If |
add_total_col |
Whether or not to add a summary column at the very end of the table containing row totals. If |
lbl_total_row |
Label of the summary row containing column totals. Only relevant if |
lbl_total_col |
Label of the summary column containing row totals. Only relevant if |
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).
A gt_tbl
object.
Other tabulation functions:
tbl_n_rfrnds()
rdb::rfrnds(quiet = TRUE) |>
rdb::tbl_n_rfrnds_per_period(period = "decade")
# grouped by a single additional column
rdb::rfrnds(quiet = TRUE) |>
rdb::tbl_n_rfrnds_per_period(by = level,
period = "decade")
# grouped by two addtional columns
rdb::rfrnds(quiet = TRUE) |>
rdb::tbl_n_rfrnds_per_period(by = c(level, type),
period = "decade")
# count ballot dates instead of referendums
rdb::rfrnds(quiet = TRUE) |>
rdb::as_ballot_dates() |>
rdb::tbl_n_rfrnds_per_period(period = "decade")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.