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)

Arguments

data

A Standard Person Query dataset in the form of a data frame.

hrvar

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).

metric

Character string containing the name of the metric, e.g. "Collaboration_hours"

mingroup

Numeric value setting the privacy threshold / minimum group size. Defaults to 5.

Value

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

Details

This function is called when the mode argument in create_rank() is specified as "combine".

Examples

# 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