R/totals_bind.R
totals_bind.Rd
Row-bind an identical data frame and impute a specific
column with the target_value
, which defaults as "Total". The purpose of
this is to enable to creation of summary tables with a calculated "Total"
row. See example below on usage.
totals_bind(data, target_col, target_value = "Total")
data frame
Character value of the column in which to impute "Total"
.
This is usually the intended grouping column.
Character value to impute in the new data frame to
row-bind. Defaults to "Total"
.
data frame with twice the number of rows of the input data frame, where half
of those rows will have the target_col
column imputed with the value from
target_value
.
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_col()
,
totals_reorder()
,
tstamp()
,
us_to_space()
,
wrap()
sq_data %>%
totals_bind(target_col = "LevelDesignation", target_value = "Total") %>%
collab_sum(hrvar = "LevelDesignation", return = "table")
#> # A tibble: 7 × 5
#> group Meeting_hours Email_hours Total Employee_Count
#> <chr> <dbl> <dbl> <dbl> <int>
#> 1 Director 9.22 9.70 18.9 68
#> 2 Executive 10.6 8.36 19.0 6
#> 3 Junior IC 9.89 9.73 19.6 105
#> 4 Manager 10.9 10.7 21.5 333
#> 5 Senior IC 10.2 9.94 20.1 103
#> 6 Support 9.47 9.37 18.8 419
#> 7 Total 10.0 9.89 19.9 1034