Skip to contents

Create pairwise combinations of HR variables and compute an average of a specified advanced insights metric.

Usage

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
pq_data_small <- dplyr::slice_sample(pq_data, prop = 0.1)

create_rank_combine(
  data = pq_data_small,
  metric = "Email_hours",
  hrvar = c("Organization", "FunctionType", "LevelDesignation")
)
#> # A tibble: 18 × 4
#>    hrvar    group                                              Email_hours     n
#>    <chr>    <chr>                                                    <dbl> <int>
#>  1 Combined [Organization] Sales and Marketing [FunctionType]…       1.46      5
#>  2 Combined [Organization] Product [FunctionType] R_and_D            1.04      5
#>  3 Combined [Organization] HR [LevelDesignation] Support             1.25     10
#>  4 Combined [Organization] Sales and Marketing [LevelDesignat…       1.04     12
#>  5 Combined [Organization] Finance [LevelDesignation] Support        1.04      8
#>  6 Combined [Organization] Product [LevelDesignation] Support        1.03      7
#>  7 Combined [FunctionType] Analytics [Organization] Sales and…       1.46      5
#>  8 Combined [FunctionType] R_and_D [Organization] Product            1.04      5
#>  9 Combined [FunctionType] Customer_Service [LevelDesignation…       1.20      6
#> 10 Combined [FunctionType] Engineering [LevelDesignation] Sup…       1.08      7
#> 11 Combined [FunctionType] Analytics [LevelDesignation] Suppo…       0.965     5
#> 12 Combined [LevelDesignation] Support [Organization] HR             1.25     10
#> 13 Combined [LevelDesignation] Support [Organization] Sales a…       1.04     12
#> 14 Combined [LevelDesignation] Support [Organization] Finance        1.04      8
#> 15 Combined [LevelDesignation] Support [Organization] Product        1.03      7
#> 16 Combined [LevelDesignation] Support [FunctionType] Custome…       1.20      6
#> 17 Combined [LevelDesignation] Support [FunctionType] Enginee…       1.08      7
#> 18 Combined [LevelDesignation] Support [FunctionType] Analyti…       0.965     5