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.
totals_reorder(data, target_col, target_value = "Total")
Summary table in the form of a data frame.
Character value of the column in which to reorder
Character value of the value in target_col
to match
data frame with the 'Total' row reordered to the bottom.
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()
sq_data %>%
totals_bind(target_col = "LevelDesignation",
target_value = "Total") %>%
collab_sum(hrvar = "LevelDesignation",
return = "table") %>%
totals_reorder(target_col = "group", target_value = "Total")
#> # A tibble: 7 × 5
#> group Meeting_hours Email_hours Total Employee_Count
#> <chr> <dbl> <dbl> <dbl> <int>
#> 1 Total 10.0 9.89 19.9 1034
#> 2 Director 9.22 9.70 18.9 68
#> 3 Executive 10.6 8.36 19.0 6
#> 4 Junior IC 9.89 9.73 19.6 105
#> 5 Manager 10.9 10.7 21.5 333
#> 6 Senior IC 10.2 9.94 20.1 103
#> 7 Support 9.47 9.37 18.8 419