Skip to contents

[Experimental]

Create a two-series line chart that visualizes a set of metric over time for the selected population, with one of the series being a four-week rolling average.

Usage

create_tracking(
  data,
  metric,
  plot_title = us_to_space(metric),
  plot_subtitle = "Measure over time",
  percent = FALSE
)

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" percentage signs. Defaults to FALSE.

plot_title

An option to override plot title.

plot_subtitle

An option to override plot subtitle.

percent

Logical value to determine whether to show labels as percentage signs. Defaults to FALSE.

Value

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

  • "plot": 'ggplot' object. A time-series plot for the metric.

  • "table": data frame. A summary table for the metric.

Examples

pq_data %>%
  create_tracking(
    metric = "Collaboration_hours",
    percent = FALSE
  )