| create_hist | R Documentation |
Provides an analysis of the distribution of a selected metric. Returns a faceted histogram by default. Additional options available to return the underlying frequency table.
create_hist(
data,
metric,
hrvar = "Organization",
mingroup = 5,
binwidth = 1,
ncol = NULL,
return = "plot"
)
data |
A Standard Person Query dataset in the form of a data frame. |
metric |
String containing the name of the metric, e.g. "Collaboration_hours" |
hrvar |
String containing the name of the HR Variable by which to split
metrics. Defaults to |
mingroup |
Numeric value setting the privacy threshold / minimum group size. Defaults to 5. |
binwidth |
Numeric value for setting |
ncol |
Numeric value setting the number of columns on the plot. Defaults
to |
return |
String specifying what to return. This must be one of the following strings:
See |
A different output is returned depending on the value passed to the return
argument:
"plot": 'ggplot' object. A faceted histogram for the metric.
"table": data frame. A summary table for the metric, containing the
following columns:
group: The HR variable by which the metric is split.
mean: The mean of the metric.
min: The minimum value of the metric.
p10: The 10th percentile of the metric.
p25: The 25th percentile of the metric.
p50: The 50th percentile of the metric.
p75: The 75th percentile of the metric.
p90: The 90th percentile of the metric.
max: The maximum value of the metric.
sd: The standard deviation of the metric.
range: The range of the metric.
n: The number of observations.
"data": data frame. Data with calculated person averages.
"frequency: list of data frames. Each data frame contains the
frequencies used in each panel of the plotted histogram.
Other Flexible:
create_bar(),
create_bar_asis(),
create_boxplot(),
create_bubble(),
create_density(),
create_dist(),
create_fizz(),
create_inc(),
create_line(),
create_line_asis(),
create_period_scatter(),
create_rank(),
create_sankey(),
create_scatter(),
create_stacked(),
create_tracking(),
create_trend()
# Return plot for whole organization
create_hist(pq_data, metric = "Collaboration_hours", hrvar = NULL)
# Return plot
create_hist(pq_data, metric = "Collaboration_hours", hrvar = "Organization")
# Return plot but coerce plot to 3 columns
create_hist(pq_data, metric = "Collaboration_hours", hrvar = "Organization", ncol = 3)
# Return summary table
create_hist(pq_data, metric = "Collaboration_hours", hrvar = "Organization", return = "table")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.