R/create_rank.R
create_rank_combine.RdCreate 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: 130 × 4
#> hrvar group Email_hours n
#> <chr> <chr> <dbl> <int>
#> 1 Combined [FunctionType] Sales [LevelDesignation] Manager 15.3 14
#> 2 Combined [FunctionType] Marketing [LevelDesignation] Manag… 15.1 24
#> 3 Combined [FunctionType] Sales [LevelDesignation] Support 13.8 9
#> 4 Combined [FunctionType] Marketing [LevelDesignation] Senio… 13.6 8
#> 5 Combined [FunctionType] Sales [LevelDesignation] Junior IC 12.5 5
#> 6 Combined [FunctionType] Operations [LevelDesignation] Seni… 12.4 5
#> 7 Combined [FunctionType] G_and_A [LevelDesignation] Senior … 11.2 6
#> 8 Combined [FunctionType] Operations [LevelDesignation] Supp… 10.9 31
#> 9 Combined [FunctionType] Marketing [LevelDesignation] Suppo… 10.8 20
#> 10 Combined [FunctionType] Engineering [LevelDesignation] Man… 10.5 7
#> # ℹ 120 more rows