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

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(sq_data)


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


# Return summary table
keymetrics_scan(sq_data, hrvar = "LevelDesignation", return = "table")
#> # A tibble: 19 × 7
#>    variable           Director Executive `Junior IC` Manager `Senior IC` Support
#>    <fct>                 <dbl>     <dbl>       <dbl>   <dbl>       <dbl>   <dbl>
#>  1 Workweek_span       43.7       43.4        41.8    42.9        42.8    41.1  
#>  2 Collaboration_hou…  18.9       19.0        19.6    21.5        20.1    18.8  
#>  3 After_hours_colla…   3.07       2.87        2.90    3.17        2.95    2.71 
#>  4 Meetings            10.1       12.1        10.8    12.1        11.1    10.4  
#>  5 Meeting_hours        9.22      10.6         9.89   10.9        10.2     9.47 
#>  6 After_hours_meeti…   1.20       1.23        1.38    1.51        1.40    1.24 
#>  7 Low_quality_meeti…   7.57       7.69        7.82    7.16        8.15    6.28 
#>  8 Meeting_hours_wit…   0.184      0.202       0.278   0.262       0.307   0.274
#>  9 Meeting_hours_wit…   0.255      0.25        6.54    3.85        6.74    6.21 
#> 10 Emails_sent         52.3       46.3        42.9    46.6        43.3    41.8  
#> 11 Email_hours          9.70       8.36        9.73   10.7         9.94    9.37 
#> 12 After_hours_email…   1.86       1.64        1.53    1.66        1.56    1.47 
#> 13 Generated_workloa…   9.24       8.07        9.38   10.4         9.58    8.99 
#> 14 Total_focus_hours   30.5       28.0        30.0    28.6        29.4    30.3  
#> 15 Internal_network_…   4.71       7.45       49.5    64.3        50.6    46.9  
#> 16 Networking_outsid…   0.0158     0.295       4.48    5.41        4.62    4.27 
#> 17 External_network_…   7.20       5.36        5.79    5.83        5.82    5.19 
#> 18 Networking_outsid…   3.56       2.62        3.18    3.17        3.26    2.81 
#> 19 Employee_Count      68          6         105     333         103     419