Skip to contents

An incidence analysis is generated, with each value in the table reflecting the proportion of the population that is above or below a threshold for a specified metric. There is an option to only provide a single hrvar in which a bar plot is generated, or two hrvar values where an incidence table (heatmap) is generated.

Usage

create_inc(
  data,
  metric,
  hrvar,
  mingroup = 5,
  threshold,
  position,
  return = "plot"
)

create_incidence(
  data,
  metric,
  hrvar,
  mingroup = 5,
  threshold,
  position,
  return = "plot"
)

Arguments

data

A Standard Person Query dataset in the form of a data frame.

metric

Character string containing the name of the metric, e.g. "Collaboration_hours"

hrvar

Character vector of at most length 2 containing the name of the HR Variable by which to split metrics.

mingroup

Numeric value setting the privacy threshold / minimum group size. Defaults to 5.

threshold

Numeric value specifying the threshold.

position

String containing the below valid values:

  • "above": show incidence of those equal to or above the threshold

  • "below": show incidence of those equal to or below the threshold

return

String specifying what to return. This must be one of the following strings:

  • "plot"

  • "table"

See Value for more information.

Value

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

  • "plot": 'ggplot' object. A heat map.

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

Examples

# Only a single HR attribute
create_inc(
  data = pq_data,
  metric = "After_hours_collaboration_hours",
  hrvar = "Organization",
  threshold = 4,
  position = "above"
)


# Two HR attributes
create_inc(
  data = pq_data,
  metric = "Collaboration_hours",
  hrvar = c("LevelDesignation", "Organization"),
  threshold = 20,
  position = "below"
)