Skip to contents

Analyse the distribution of weekly after-hours collaboration time. Returns a stacked bar plot by default. Additional options available to return a table with distribution elements.

Usage

afterhours_dist(
  data,
  hrvar = "Organization",
  mingroup = 5,
  return = "plot",
  cut = c(1, 2, 3)
)

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 vector specifying the cuts to use for the data, accepting "default" or "range-cut" as character vector, or a numeric value of length three to specify the exact breaks to use. e.g. c(1, 3, 5)

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 After_hours_collaboration_hours. See create_dist() for applying the same analysis to a different metric.

Examples

# Return plot
afterhours_dist(pq_data, hrvar = "Organization")


# Return summary table
afterhours_dist(pq_data, hrvar = "Organization", return = "table")
#> # A tibble: 4 × 6
#>   group        `< 1 hours` `1 - 2 hours` `2 - 3 hours` `3+ hours` Employee_Count
#>   <fct>              <dbl>         <dbl>         <dbl>      <dbl>          <int>
#> 1 Finance          NA              0.370        0.111       0.519             27
#> 2 HR               NA              0.286        0.190       0.524             21
#> 3 Product           0.0476         0.476        0.0476      0.429             21
#> 4 Sales and M…     NA              0.161        0.258       0.581             31

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