Skip to contents

This function enables you to create a count of the distinct people by the specified HR attribute.The default behaviour is to return a bar chart as typically seen in 'Analysis Scope'.

Usage

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

analysis_scope(data, hrvar = "Organization", 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.

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_count(pq_data, hrvar = "LevelDesignation")


# Return a summary table
hrvar_count(pq_data, hrvar = "LevelDesignation", return = "table")
#> # A tibble: 4 × 2
#>   LevelDesignation     n
#>   <chr>            <int>
#> 1 Junior IC          136
#> 2 Senior IC           87
#> 3 Senior Manager      40
#> 4 Executive           37