Analyze the distribution of External Collaboration Hours. Returns a stacked bar plot by default. Additional options available to return a table with distribution elements.

external_dist(
  data,
  hrvar = "Organization",
  mingroup = 5,
  return = "plot",
  cut = c(5, 10, 15)
)

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

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:

  • "plot"

  • "table"

See Value for more information.

cut

A numeric vector of length three to specify the breaks for the distribution, e.g. c(10, 15, 20)

Value

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

  • "plot": 'ggplot' object. A stacked bar plot for the metric.

  • "table": data frame. A summary table for the metric.

Details

Uses the metric External_collaboration_hours. See create_dist() for applying the same analysis to a different metric.

Examples

# Return plot
external_dist(sq_data, hrvar = "Organization")


# Return summary table
external_dist(sq_data, hrvar = "Organization", return = "table")
#> # A tibble: 15 × 6
#>    group                `< 5 hours` `5 - 10 hours` 10 - 15 hou…¹ 15+ h…² Emplo…³
#>    <fct>                      <dbl>          <dbl>         <dbl>   <dbl>   <int>
#>  1 Biz Dev                    1            NA            NA      NA           75
#>  2 Customer Service           0.836         0.0492        0.0984  0.0164      61
#>  3 Facilities                 0.694         0.306        NA      NA           72
#>  4 Finance-Corporate          0.794         0.206        NA      NA           68
#>  5 Finance-East               0.371         0.414         0.214  NA           70
#>  6 Finance-South              0.630         0.370        NA      NA           81
#>  7 Finance-West               0.562         0.315         0.123  NA           73
#>  8 Financial Planning         0.853         0.0133        0.133  NA           75
#>  9 G&A Central                0.684         0.316        NA      NA           57
#> 10 G&A East                   1            NA            NA      NA           65
#> 11 G&A South                  0.789         0.211        NA      NA           76
#> 12 Human Resources            0.732         0.268        NA      NA           71
#> 13 IT-Corporate               0.735         0.0294        0.176   0.0588      68
#> 14 IT-East                    0.887         0.113        NA      NA           62
#> 15 Inventory Management       0.55          0.183         0.25    0.0167      60
#> # … with abbreviated variable names ¹​`10 - 15 hours`, ²​`15+ hours`,
#> #   ³​Employee_Count

# Return result with a custom specified breaks
external_dist(sq_data, hrvar = "LevelDesignation", cut = c(4, 7, 9))