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.

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: 5 × 2
#>   LevelDesignation     n
#>   <chr>            <int>
#> 1 Support             53
#> 2 Senior IC           20
#> 3 Manager             11
#> 4 Junior IC           10
#> 5 Director             6