2020-10-27 00:21:24 +03:00
|
|
|
% Generated by roxygen2: do not edit by hand
|
|
|
|
% Please edit documentation in R/create_bar_asis.R
|
|
|
|
\name{create_bar_asis}
|
|
|
|
\alias{create_bar_asis}
|
2020-11-19 15:41:01 +03:00
|
|
|
\title{Create a bar chart without aggregation for any metric}
|
2020-10-27 00:21:24 +03:00
|
|
|
\usage{
|
|
|
|
create_bar_asis(
|
|
|
|
data,
|
|
|
|
group_var,
|
|
|
|
bar_var,
|
|
|
|
title = NULL,
|
|
|
|
subtitle = NULL,
|
|
|
|
caption = NULL,
|
|
|
|
ylab = group_var,
|
|
|
|
xlab = bar_var,
|
|
|
|
percent = FALSE,
|
2021-02-12 20:44:43 +03:00
|
|
|
bar_colour = "default",
|
|
|
|
rounding = 1
|
2020-10-27 00:21:24 +03:00
|
|
|
)
|
|
|
|
}
|
|
|
|
\arguments{
|
|
|
|
\item{data}{Plotting data as a data frame.}
|
|
|
|
|
|
|
|
\item{group_var}{String containing name of variable for the group.}
|
|
|
|
|
2021-02-12 20:16:24 +03:00
|
|
|
\item{bar_var}{String containing name of variable representing the value of
|
|
|
|
the bars.}
|
2020-10-27 00:21:24 +03:00
|
|
|
|
|
|
|
\item{title}{Title of the plot.}
|
|
|
|
|
|
|
|
\item{subtitle}{Subtitle of the plot.}
|
|
|
|
|
|
|
|
\item{caption}{Caption of the plot.}
|
|
|
|
|
|
|
|
\item{ylab}{Y-axis label for the plot (group axis)}
|
|
|
|
|
|
|
|
\item{xlab}{X-axis label of the plot (bar axis).}
|
|
|
|
|
2021-02-12 20:16:24 +03:00
|
|
|
\item{percent}{Logical value to determine whether to show labels as
|
2021-03-04 21:33:28 +03:00
|
|
|
percentage signs. Defaults to \code{FALSE}.}
|
2020-10-27 00:21:24 +03:00
|
|
|
|
|
|
|
\item{bar_colour}{String to specify colour to use for bars.
|
|
|
|
In-built accepted values include "default" (default), "alert" (red), and
|
|
|
|
"darkblue". Otherwise, hex codes are also accepted. You can also supply
|
|
|
|
RGB values via \code{rgb2hex()}.}
|
2021-02-12 20:44:43 +03:00
|
|
|
|
|
|
|
\item{rounding}{Numeric value to specify number of digits to show in data
|
|
|
|
labels}
|
2020-10-27 00:21:24 +03:00
|
|
|
}
|
2021-02-12 20:16:24 +03:00
|
|
|
\value{
|
2021-03-30 19:40:16 +03:00
|
|
|
'ggplot' object. A horizontal bar plot.
|
2021-02-12 20:16:24 +03:00
|
|
|
}
|
2020-10-27 00:21:24 +03:00
|
|
|
\description{
|
2021-02-12 20:16:24 +03:00
|
|
|
This function creates a bar chart directly from the aggregated / summarised
|
|
|
|
data. Unlike \code{create_bar()} which performs a person-level aggregation, there
|
|
|
|
is no calculation for \code{create_bar_asis()} and the values are rendered as they
|
|
|
|
are passed into the function.
|
|
|
|
}
|
|
|
|
\examples{
|
|
|
|
# Creating a custom bar plot without mean aggregation
|
|
|
|
library(dplyr)
|
|
|
|
|
|
|
|
sq_data \%>\%
|
|
|
|
group_by(Organization) \%>\%
|
|
|
|
summarise(across(.cols = Meeting_hours,
|
|
|
|
.fns = ~sum(., na.rm = TRUE))) \%>\%
|
|
|
|
create_bar_asis(group_var = "Organization",
|
|
|
|
bar_var = "Meeting_hours",
|
|
|
|
title = "Total Meeting Hours over period",
|
|
|
|
subtitle = "By Organization",
|
|
|
|
caption = extract_date_range(sq_data, return = "text"),
|
2021-02-12 20:44:43 +03:00
|
|
|
bar_colour = "darkblue",
|
|
|
|
rounding = 0)
|
2021-02-12 20:16:24 +03:00
|
|
|
|
2021-03-04 21:33:28 +03:00
|
|
|
library(dplyr)
|
|
|
|
|
|
|
|
# Summarise Non-person-average median `Emails_sent`
|
|
|
|
med_df <-
|
|
|
|
sq_data \%>\%
|
|
|
|
group_by(Organization) \%>\%
|
|
|
|
summarise(Emails_sent_median = median(Emails_sent))
|
|
|
|
|
|
|
|
med_df \%>\%
|
|
|
|
create_bar_asis(
|
|
|
|
group_var = "Organization",
|
|
|
|
bar_var = "Emails_sent_median",
|
|
|
|
title = "Median Emails Sent by Organization",
|
|
|
|
subtitle = "Person Averaging Not Applied",
|
|
|
|
bar_colour = "darkblue",
|
|
|
|
caption = extract_date_range(sq_data, return = "text")
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2020-10-27 00:21:24 +03:00
|
|
|
}
|
2020-11-07 00:36:17 +03:00
|
|
|
\seealso{
|
2021-03-04 21:33:28 +03:00
|
|
|
Other Visualization:
|
|
|
|
\code{\link{afterhours_dist}()},
|
|
|
|
\code{\link{afterhours_fizz}()},
|
|
|
|
\code{\link{afterhours_line}()},
|
|
|
|
\code{\link{afterhours_rank}()},
|
|
|
|
\code{\link{afterhours_summary}()},
|
|
|
|
\code{\link{afterhours_trend}()},
|
|
|
|
\code{\link{collaboration_area}()},
|
|
|
|
\code{\link{collaboration_dist}()},
|
|
|
|
\code{\link{collaboration_fizz}()},
|
|
|
|
\code{\link{collaboration_line}()},
|
|
|
|
\code{\link{collaboration_rank}()},
|
|
|
|
\code{\link{collaboration_sum}()},
|
|
|
|
\code{\link{collaboration_trend}()},
|
|
|
|
\code{\link{create_bar}()},
|
|
|
|
\code{\link{create_boxplot}()},
|
|
|
|
\code{\link{create_bubble}()},
|
|
|
|
\code{\link{create_dist}()},
|
|
|
|
\code{\link{create_fizz}()},
|
2021-11-03 14:59:51 +03:00
|
|
|
\code{\link{create_inc}()},
|
2021-03-04 21:33:28 +03:00
|
|
|
\code{\link{create_line_asis}()},
|
|
|
|
\code{\link{create_line}()},
|
|
|
|
\code{\link{create_period_scatter}()},
|
|
|
|
\code{\link{create_rank}()},
|
|
|
|
\code{\link{create_sankey}()},
|
|
|
|
\code{\link{create_scatter}()},
|
|
|
|
\code{\link{create_stacked}()},
|
2021-06-14 15:54:09 +03:00
|
|
|
\code{\link{create_tracking}()},
|
2021-03-04 21:33:28 +03:00
|
|
|
\code{\link{create_trend}()},
|
|
|
|
\code{\link{email_dist}()},
|
|
|
|
\code{\link{email_fizz}()},
|
|
|
|
\code{\link{email_line}()},
|
|
|
|
\code{\link{email_rank}()},
|
|
|
|
\code{\link{email_summary}()},
|
|
|
|
\code{\link{email_trend}()},
|
2021-03-05 01:19:07 +03:00
|
|
|
\code{\link{external_network_plot}()},
|
2021-03-05 14:18:35 +03:00
|
|
|
\code{\link{hr_trend}()},
|
|
|
|
\code{\link{hrvar_count}()},
|
2021-05-05 12:08:10 +03:00
|
|
|
\code{\link{hrvar_trend}()},
|
2021-03-05 17:05:00 +03:00
|
|
|
\code{\link{internal_network_plot}()},
|
|
|
|
\code{\link{keymetrics_scan}()},
|
|
|
|
\code{\link{meeting_dist}()},
|
|
|
|
\code{\link{meeting_fizz}()},
|
|
|
|
\code{\link{meeting_line}()},
|
|
|
|
\code{\link{meeting_quality}()},
|
|
|
|
\code{\link{meeting_rank}()},
|
|
|
|
\code{\link{meeting_summary}()},
|
|
|
|
\code{\link{meeting_trend}()},
|
|
|
|
\code{\link{meetingtype_dist_ca}()},
|
|
|
|
\code{\link{meetingtype_dist_mt}()},
|
|
|
|
\code{\link{meetingtype_dist}()},
|
|
|
|
\code{\link{meetingtype_summary}()},
|
|
|
|
\code{\link{mgrcoatt_dist}()},
|
|
|
|
\code{\link{mgrrel_matrix}()},
|
|
|
|
\code{\link{one2one_dist}()},
|
|
|
|
\code{\link{one2one_fizz}()},
|
2021-03-10 00:24:29 +03:00
|
|
|
\code{\link{one2one_freq}()},
|
2021-03-05 17:05:00 +03:00
|
|
|
\code{\link{one2one_line}()},
|
|
|
|
\code{\link{one2one_rank}()},
|
|
|
|
\code{\link{one2one_sum}()},
|
|
|
|
\code{\link{one2one_trend}()},
|
|
|
|
\code{\link{period_change}()},
|
|
|
|
\code{\link{workloads_dist}()},
|
|
|
|
\code{\link{workloads_fizz}()},
|
|
|
|
\code{\link{workloads_line}()},
|
|
|
|
\code{\link{workloads_rank}()},
|
|
|
|
\code{\link{workloads_summary}()},
|
|
|
|
\code{\link{workloads_trend}()},
|
|
|
|
\code{\link{workpatterns_area}()},
|
|
|
|
\code{\link{workpatterns_rank}()}
|
2021-03-04 21:33:28 +03:00
|
|
|
|
|
|
|
Other Flexible:
|
2020-11-07 00:36:17 +03:00
|
|
|
\code{\link{create_bar}()},
|
|
|
|
\code{\link{create_boxplot}()},
|
2020-11-25 19:47:26 +03:00
|
|
|
\code{\link{create_bubble}()},
|
2021-03-04 21:33:28 +03:00
|
|
|
\code{\link{create_dist}()},
|
|
|
|
\code{\link{create_fizz}()},
|
|
|
|
\code{\link{create_hist}()},
|
2021-11-03 14:59:51 +03:00
|
|
|
\code{\link{create_inc}()},
|
2021-03-04 21:33:28 +03:00
|
|
|
\code{\link{create_line_asis}()},
|
|
|
|
\code{\link{create_line}()},
|
|
|
|
\code{\link{create_period_scatter}()},
|
|
|
|
\code{\link{create_rank}()},
|
|
|
|
\code{\link{create_sankey}()},
|
2020-11-07 00:36:17 +03:00
|
|
|
\code{\link{create_scatter}()},
|
2021-03-04 21:33:28 +03:00
|
|
|
\code{\link{create_stacked}()},
|
2021-06-14 15:54:09 +03:00
|
|
|
\code{\link{create_tracking}()},
|
2021-03-05 17:05:00 +03:00
|
|
|
\code{\link{create_trend}()},
|
|
|
|
\code{\link{period_change}()}
|
2020-11-07 00:36:17 +03:00
|
|
|
}
|
2021-03-04 21:33:28 +03:00
|
|
|
\concept{Flexible}
|
|
|
|
\concept{Visualization}
|