Skip to contents

This function scans a standard query output for groups with of employees under the privacy threshold. The method consists in reviewing each individual HR attribute, and count the distinct people within each group.

Usage

identify_privacythreshold(
  data,
  hrvar = extract_hr(data),
  mingroup = 5,
  return = "table"
)

Arguments

data

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

hrvar

A list of HR Variables to consider in the scan. Defaults to all HR attributes identified.

mingroup

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

return

String specifying what to return. This must be one of the following strings:

  • "table"

  • "text"

See Value for more information.

Value

A different output is returned depending on the value passed to the return

argument:

  • "table": data frame. A summary table of groups that fall below the privacy threshold.

  • "text": string. A diagnostic message.

Returns a ggplot object by default, where 'plot' is passed in return. When 'table' is passed, a summary table is returned as a data frame.

Examples

# Return a summary table
pq_data %>% identify_privacythreshold(return = "table")
#> # A tibble: 22 × 3
#>    hrvar               group                                   n
#>    <chr>               <chr>                               <int>
#>  1 WeekendDays         [SUNDAY, TUESDAY, FRIDAY, SATURDAY]     1
#>  2 LevelDesignation    Director                                6
#>  3 SupervisorIndicator Manager+                                6
#>  4 FunctionType        G_and_A                                 6
#>  5 LevelDesignation    Junior IC                              10
#>  6 LevelDesignation    Manager                                11
#>  7 SupervisorIndicator Manager                                11
#>  8 FunctionType        Sales                                  11
#>  9 FunctionType        IT                                     11
#> 10 FunctionType        Analytics                              12
#> # ℹ 12 more rows

# Return a diagnostic message
pq_data %>% identify_privacythreshold(return = "text")
#> [1] "[Pass] There is only 1 group under the minimum group size privacy threshold of 5."