Skip to contents

Returns a heatmapped table by default, with options to return a table.

Usage

keymetrics_scan(
  data,
  hrvar = "Organization",
  mingroup = 5,
  metrics = c("Workweek_span", "Collaboration_hours", "After_hours_collaboration_hours",
    "Meetings", "Meeting_hours", "After_hours_meeting_hours",
    "Low_quality_meeting_hours", "Meeting_hours_with_manager_1_on_1",
    "Meeting_hours_with_manager", "Emails_sent", "Email_hours",
    "After_hours_email_hours", "Generated_workload_email_hours", "Total_focus_hours",
    "Internal_network_size", "Networking_outside_organization", "External_network_size",
    "Networking_outside_company"),
  return = "plot",
  low = rgb2hex(7, 111, 161),
  mid = rgb2hex(241, 204, 158),
  high = rgb2hex(216, 24, 42),
  textsize = 2
)

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.

metrics

A character vector containing the variable names to calculate averages of.

return

Character vector specifying what to return, defaults to "plot". Valid inputs are "plot" and "table".

low

String specifying colour code to use for low-value metrics. Arguments are passed directly to ggplot2::scale_fill_gradient2().

mid

String specifying colour code to use for mid-value metrics. Arguments are passed directly to ggplot2::scale_fill_gradient2().

high

String specifying colour code to use for high-value metrics. Arguments are passed directly to ggplot2::scale_fill_gradient2().

textsize

A numeric value specifying the text size to show in the plot.

Value

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

Examples

# Heatmap plot is returned by default
keymetrics_scan(pq_data)


# Heatmap plot with custom colours
keymetrics_scan(pq_data, low = "purple", high = "yellow")


# Return summary table
keymetrics_scan(pq_data, hrvar = "LevelDesignation", return = "table")
#> # A tibble: 11 × 6
#>    variable                     Director `Junior IC` Manager `Senior IC` Support
#>    <fct>                           <dbl>       <dbl>   <dbl>       <dbl>   <dbl>
#>  1 Collaboration_hours             72.0       21.4    26.9        12.1    12.9  
#>  2 After_hours_collaboration_h…    42.4       11.6    13.1         4.60    5.20 
#>  3 Meetings                        45.3       10.9    21.1        11.3    11.5  
#>  4 Meeting_hours                   71.5       20.8    26.1        11.3    12.2  
#>  5 After_hours_meeting_hours       41.9       11.2    12.5         4.02    4.66 
#>  6 Meeting_hours_with_manager      32.2        8.26   17.7         6.86    7.36 
#>  7 Emails_sent                     99.7       33.0    59.6        37.1    36.0  
#>  8 Email_hours                      2.50       0.991   1.53        1.11    1.08 
#>  9 After_hours_email_hours          1.22       0.587   0.839       0.709   0.665
#> 10 Internal_network_size           78.0       27.6    47.3        32.7    29.3  
#> 11 Employee_Count                   6         10      11          20      53