Skip to contents

This function provides a week by week view of the count of the distinct people by the specified HR attribute.The default behaviour is to return a week by week heatmap bar plot.

Usage

hrvar_trend(data, hrvar = "Organization", return = "plot")

Arguments

data

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

hrvar

HR Variable by which to split metrics, defaults to "Organization" but accepts any character vector, e.g. "LevelDesignation". If a vector with more than one value is provided, the HR attributes are automatically concatenated.

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 containing a bar plot.

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

Examples

# Return a bar plot
hrvar_trend(pq_data, hrvar = "LevelDesignation")


# Return a summary table
hrvar_trend(pq_data, hrvar = "LevelDesignation", return = "table")
#> # A tibble: 5 × 11
#>   group     `2022-05-01` `2022-05-08` `2022-05-15` `2022-05-22` `2022-05-29`
#>   <chr>            <dbl>        <dbl>        <dbl>        <dbl>        <dbl>
#> 1 Director             6            6            6            6            6
#> 2 Junior IC           10           10           10           10           10
#> 3 Manager             11           11           11           11           11
#> 4 Senior IC           20           20           20           20           20
#> 5 Support             53           53           53           53           53
#> # ℹ 5 more variables: `2022-06-05` <dbl>, `2022-06-12` <dbl>,
#> #   `2022-06-19` <dbl>, `2022-06-26` <dbl>, `2022-07-03` <dbl>