totals_reorder: Reorder a value to the top of the summary table

View source: R/totals_reorder.R

totals_reorderR Documentation

Reorder a value to the top of the summary table

Description

For a given data frame, reorder a row to the first row of that data frame through matching a value of a variable. The intended usage of this function is to be used for reordering the "Total" row, and not with "flat" data. This can be used in conjunction with totals_bind(), which is used to create a "Total" row in the data.

Usage

totals_reorder(data, target_col, target_value = "Total")

Arguments

data

Summary table in the form of a data frame.

target_col

Character value of the column in which to reorder

target_value

Character value of the value in target_col to match

Value

data frame with the 'Total' row reordered to the bottom.

See Also

Other Support: camel_clean(), check_inputs(), combine_signals(), cut_hour(), extract_date_range(), extract_hr(), heat_colours(), is_date_format(), maxmin(), p_test(), pairwise_count(), plot_WOE(), read_preamble(), rgb2hex(), totals_bind(), totals_col(), tstamp(), us_to_space(), wrap()

Examples

sq_data %>%
  totals_bind(target_col = "LevelDesignation",
              target_value = "Total") %>%
  collab_sum(hrvar = "LevelDesignation",
             return = "table") %>%
  totals_reorder(target_col = "group", target_value = "Total")


wpa documentation built on Aug. 21, 2023, 5:11 p.m.