Generate the Manager-Relationship 2x2 matrix, returning a 'ggplot' object by default. Additional options available to return a "wide" or "long" summary table.

mgrrel_matrix(
  data,
  hrvar = NULL,
  mingroup = 5,
  return = "plot",
  plot_colors = c("#fe7f4f", "#b4d5dd", "#facebc", "#fcf0eb"),
  threshold = 15
)

Arguments

data

Standard Person Query data to pass through. Accepts a data frame.

hrvar

HR Variable by which to split metrics. Accepts a character vector, e.g. "Organization". Defaults to NULL.

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"

  • "data"

See Value for more information.

plot_colors

Pass a character vector of length 4 containing HEX codes to specify colors to use in plotting.

threshold

Specify a numeric value to determine threshold (in minutes) for 1:1 manager hours. Defaults to 15.

Value

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

argument:

  • "plot": ggplot object. When NULL is passed to hrvar, a two-by-two grid where the size of the grid represents total percentage of employees is returned. Otherwise, a horizontal stacked bar plot is returned.

  • "table": data frame. A summary table is returned.

  • "data": data frame. A long table grouped at the PersonId level with the following columns:

    • PersonId

    • HR variable supplied to hrvar

    • CoattendanceRate

    • Meeting_hours_with_manager_1_on_1

    • mgr1on1

    • Type

See also

Other Visualization: afterhours_dist(), afterhours_fizz(), afterhours_line(), afterhours_rank(), afterhours_summary(), afterhours_trend(), collaboration_area(), collaboration_dist(), collaboration_fizz(), collaboration_line(), collaboration_rank(), collaboration_sum(), collaboration_trend(), create_bar_asis(), create_bar(), create_boxplot(), create_bubble(), create_dist(), create_fizz(), create_inc(), create_line_asis(), create_line(), create_period_scatter(), create_rank(), create_sankey(), create_scatter(), create_stacked(), create_tracking(), create_trend(), email_dist(), email_fizz(), email_line(), email_rank(), email_summary(), email_trend(), external_dist(), external_fizz(), external_line(), external_network_plot(), external_rank(), external_sum(), hr_trend(), hrvar_count(), hrvar_trend(), internal_network_plot(), keymetrics_scan(), meeting_dist(), meeting_fizz(), meeting_line(), meeting_quality(), meeting_rank(), meeting_summary(), meeting_trend(), meetingtype_dist_ca(), meetingtype_dist_mt(), meetingtype_dist(), meetingtype_summary(), mgrcoatt_dist(), one2one_dist(), one2one_fizz(), one2one_freq(), one2one_line(), one2one_rank(), one2one_sum(), one2one_trend(), period_change(), workloads_dist(), workloads_fizz(), workloads_line(), workloads_rank(), workloads_summary(), workloads_trend(), workpatterns_area(), workpatterns_rank()

Other Managerial Relations: mgrcoatt_dist(), one2one_dist(), one2one_fizz(), one2one_freq(), one2one_line(), one2one_rank(), one2one_sum(), one2one_trend()

Author

Lucas Hogner lucas.hogner@microsoft.com

Examples

# Return matrix
mgrrel_matrix(sq_data)


# Return stacked bar plot
mgrrel_matrix(sq_data, hrvar = "Organization")


## Visualize coaching style types
# Ensure dplyr is loaded
library(dplyr)

# Extract PersonId and Coaching Type
match_df <-
  sq_data %>%
  mgrrel_matrix(return = "data") %>%
  select(PersonId, Type)

# Join and visualize baseline
sq_data %>%
  left_join(match_df, by = "PersonId") %>%
  keymetrics_scan(hrvar = "Type",
                  return = "plot")