R/create_rank.R
create_rank_combine.Rd
Create pairwise combinations of HR variables and compute an average of a specified advanced insights metric.
create_rank_combine(data, hrvar = extract_hr(data), metric, mingroup = 5)
A Standard Person Query dataset in the form of a data frame.
String containing the name of the HR Variable by which to split
metrics. Defaults to "Organization"
. To run the analysis on the total
instead of splitting by an HR attribute, supply NULL
(without quotes).
Character string containing the name of the metric, e.g. "Collaboration_hours"
Numeric value setting the privacy threshold / minimum group size. Defaults to 5.
Data frame containing the following variables:
hrvar
: placeholder column that denotes the output as "Combined"
.
group
: pairwise combinations of HR attributes with the HR attribute
in square brackets followed by the value of the HR attribute.
Name of the metric (as passed to metric
)
n
This function is called when the mode
argument in create_rank()
is
specified as "combine"
.
# Use a small sample for faster runtime
sq_data_small <- dplyr::slice_sample(sq_data, prop = 0.1)
create_rank_combine(
data = sq_data_small,
metric = "Email_hours"
)
#> # A tibble: 292 × 4
#> hrvar group Email_…¹ n
#> <chr> <chr> <dbl> <int>
#> 1 Combined [FunctionType] Sales [LevelDesignation] Junior IC 15.2 8
#> 2 Combined [FunctionType] Sales [LevelDesignation] Manager 14.8 21
#> 3 Combined [FunctionType] Marketing [LevelDesignation] Manager 14.1 58
#> 4 Combined [FunctionType] Sales [LevelDesignation] Support 13.8 18
#> 5 Combined [FunctionType] Sales [LevelDesignation] Senior IC 13.7 10
#> 6 Combined [FunctionType] Marketing [LevelDesignation] Director 13.5 10
#> 7 Combined [FunctionType] Marketing [LevelDesignation] Senior IC 12.6 17
#> 8 Combined [FunctionType] Engineering [LevelDesignation] Manager 12.2 24
#> 9 Combined [FunctionType] Marketing [LevelDesignation] Support 11.5 64
#> 10 Combined [FunctionType] Marketing [LevelDesignation] Junior IC 10.9 9
#> # … with 282 more rows, and abbreviated variable name ¹Email_hours