Skip to contents

Returns a line chart showing the change in employee count over time. Part of a data validation process to check for unusual license growth / declines over time.

Usage

hr_trend(data, return = "plot")

Arguments

data

A Standard Person Query dataset in the form of a data frame. This must be a panel dataset where each row represents one employee per time period, with the columns PersonId and MetricDate present.

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 line plot showing employee count over time.

  • "table": data frame containing a summary table.

Examples

# Return plot
hr_trend(pq_data)


# Return summary table
hr_trend(pq_data, return = "table")
#> # A tibble: 23 × 2
#>    Date           n
#>    <date>     <int>
#>  1 2024-04-28   300
#>  2 2024-05-05   300
#>  3 2024-05-12   300
#>  4 2024-05-19   300
#>  5 2024-05-26   300
#>  6 2024-06-02   300
#>  7 2024-06-09   300
#>  8 2024-06-16   300
#>  9 2024-06-23   300
#> 10 2024-06-30   300
#> # ℹ 13 more rows