зеркало из https://github.com/microsoft/wpa.git
feat: add create_line_asis
- Also add other documentation tweaks to Family
This commit is contained in:
Родитель
164468004a
Коммит
974e56c85d
|
@ -40,6 +40,7 @@ export(create_dist)
|
|||
export(create_dt)
|
||||
export(create_fizz)
|
||||
export(create_line)
|
||||
export(create_line_asis)
|
||||
export(create_period_scatter)
|
||||
export(create_rank)
|
||||
export(create_scatter)
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#' @import ggplot2
|
||||
#' @import dplyr
|
||||
#'
|
||||
#' @family General
|
||||
#'
|
||||
#' @export
|
||||
create_bar_asis <- function(data,
|
||||
group_var,
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#' @importFrom stats median
|
||||
#' @importFrom stats sd
|
||||
#'
|
||||
#' @family Collaboration
|
||||
#' @family General
|
||||
#'
|
||||
#' @examples
|
||||
#' ## Return a plot
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
#' @title Create a line chart without aggregation
|
||||
#'
|
||||
#' @description
|
||||
#' This function creates a line chart directly from the aggregated / summarised data.
|
||||
#' Unlike `create_line()` which performs a person-level aggregation, there is no
|
||||
#' calculation for `create_line_asis()` and the values are rendered as they are passed
|
||||
#' into the function. The only requirement is that a `date_var` is provided for the x-axis.
|
||||
#'
|
||||
#' @param data Plotting data as a data frame.
|
||||
#' @param date_var String containing name of variable for the horizontal axis.
|
||||
#' @param metric String containing name of variable representing the line.
|
||||
#' @param title Title of the plot.
|
||||
#' @param subtitle Subtitle of the plot.
|
||||
#' @param caption Caption of the plot.
|
||||
#' @param ylab Y-axis label for the plot (group axis)
|
||||
#' @param xlab X-axis label of the plot (bar axis).
|
||||
#' @param line_colour String to specify colour to use for the line.
|
||||
#' Hex codes are accepted. You can also supply
|
||||
#' RGB values via `rgb2hex()`.
|
||||
#'
|
||||
#' @import ggplot2
|
||||
#' @import dplyr
|
||||
#'
|
||||
#' @family General
|
||||
#'
|
||||
#' @export
|
||||
create_line_asis <- function(data,
|
||||
date_var = "Date",
|
||||
metric,
|
||||
title = NULL,
|
||||
subtitle = NULL,
|
||||
caption = NULL,
|
||||
ylab = date_var,
|
||||
xlab = metric,
|
||||
line_colour = rgb2hex(0, 120, 212)){
|
||||
|
||||
returnPlot <-
|
||||
data %>%
|
||||
mutate_at(vars(date_var), ~as.Date(., format = "%m/%d/%Y")) %>%
|
||||
ggplot(aes(x = !!sym(date_var), y = !!sym(metric))) +
|
||||
geom_line(colour = line_colour)
|
||||
|
||||
returnPlot +
|
||||
labs(title = title,
|
||||
subtitle = subtitle,
|
||||
caption = caption,
|
||||
y = xlab,
|
||||
x = ylab) +
|
||||
theme_wpa_basic()
|
||||
}
|
|
@ -39,7 +39,6 @@ Other Collaboration:
|
|||
\code{\link{collaboration_rank}()},
|
||||
\code{\link{collaboration_sum}()},
|
||||
\code{\link{collaboration_trend}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{meeting_trend}()}
|
||||
}
|
||||
\concept{Collaboration}
|
||||
|
|
|
@ -65,7 +65,6 @@ Other Collaboration:
|
|||
\code{\link{collaboration_rank}()},
|
||||
\code{\link{collaboration_sum}()},
|
||||
\code{\link{collaboration_trend}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{meeting_trend}()}
|
||||
}
|
||||
\concept{Collaboration}
|
||||
|
|
|
@ -35,7 +35,6 @@ Other Collaboration:
|
|||
\code{\link{collaboration_rank}()},
|
||||
\code{\link{collaboration_sum}()},
|
||||
\code{\link{collaboration_trend}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{meeting_trend}()}
|
||||
}
|
||||
\concept{Collaboration}
|
||||
|
|
|
@ -48,7 +48,6 @@ Other Collaboration:
|
|||
\code{\link{collaboration_rank}()},
|
||||
\code{\link{collaboration_sum}()},
|
||||
\code{\link{collaboration_trend}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{meeting_trend}()}
|
||||
}
|
||||
\concept{Collaboration}
|
||||
|
|
|
@ -43,7 +43,6 @@ Other Collaboration:
|
|||
\code{\link{collaboration_line}()},
|
||||
\code{\link{collaboration_sum}()},
|
||||
\code{\link{collaboration_trend}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{meeting_trend}()}
|
||||
}
|
||||
\concept{Collaboration}
|
||||
|
|
|
@ -51,7 +51,6 @@ Other Collaboration:
|
|||
\code{\link{collaboration_line}()},
|
||||
\code{\link{collaboration_rank}()},
|
||||
\code{\link{collaboration_trend}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{meeting_trend}()}
|
||||
}
|
||||
\concept{Collaboration}
|
||||
|
|
|
@ -42,7 +42,6 @@ Other Collaboration:
|
|||
\code{\link{collaboration_line}()},
|
||||
\code{\link{collaboration_rank}()},
|
||||
\code{\link{collaboration_sum}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{meeting_trend}()}
|
||||
}
|
||||
\concept{Collaboration}
|
||||
|
|
|
@ -56,8 +56,11 @@ create_bar(sq_data, metric = "Collaboration_hours", hrvar = "LevelDesignation",
|
|||
}
|
||||
\seealso{
|
||||
Other General:
|
||||
\code{\link{create_bar_asis}()},
|
||||
\code{\link{create_boxplot}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{create_fizz}()},
|
||||
\code{\link{create_line_asis}()},
|
||||
\code{\link{create_line}()},
|
||||
\code{\link{create_period_scatter}()},
|
||||
\code{\link{create_rank}()},
|
||||
|
|
|
@ -47,3 +47,21 @@ Unlike \code{create_bar()} which performs a person-level aggregation, there is n
|
|||
calculation for \code{create_bar_asis()} and the values are rendered as they are passed
|
||||
into the function.
|
||||
}
|
||||
\seealso{
|
||||
Other General:
|
||||
\code{\link{create_bar}()},
|
||||
\code{\link{create_boxplot}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{create_fizz}()},
|
||||
\code{\link{create_line_asis}()},
|
||||
\code{\link{create_line}()},
|
||||
\code{\link{create_period_scatter}()},
|
||||
\code{\link{create_rank}()},
|
||||
\code{\link{create_scatter}()},
|
||||
\code{\link{create_stacked}()},
|
||||
\code{\link{cut_hour}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{hrvar_count}()},
|
||||
\code{\link{identify_outlier}()}
|
||||
}
|
||||
\concept{General}
|
||||
|
|
|
@ -45,8 +45,11 @@ create_boxplot(sq_data, metric = "Collaboration_hours", hrvar = "LevelDesignatio
|
|||
}
|
||||
\seealso{
|
||||
Other General:
|
||||
\code{\link{create_bar_asis}()},
|
||||
\code{\link{create_bar}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{create_fizz}()},
|
||||
\code{\link{create_line_asis}()},
|
||||
\code{\link{create_line}()},
|
||||
\code{\link{create_period_scatter}()},
|
||||
\code{\link{create_rank}()},
|
||||
|
|
|
@ -46,14 +46,20 @@ create_dist(sq_data, metric = "Collaboration_hours", hrvar = "Organization")
|
|||
create_dist(sq_data, metric = "Collaboration_hours", hrvar = "Organization", return = "table")
|
||||
}
|
||||
\seealso{
|
||||
Other Collaboration:
|
||||
\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{meeting_trend}()}
|
||||
Other General:
|
||||
\code{\link{create_bar_asis}()},
|
||||
\code{\link{create_bar}()},
|
||||
\code{\link{create_boxplot}()},
|
||||
\code{\link{create_fizz}()},
|
||||
\code{\link{create_line_asis}()},
|
||||
\code{\link{create_line}()},
|
||||
\code{\link{create_period_scatter}()},
|
||||
\code{\link{create_rank}()},
|
||||
\code{\link{create_scatter}()},
|
||||
\code{\link{create_stacked}()},
|
||||
\code{\link{cut_hour}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{hrvar_count}()},
|
||||
\code{\link{identify_outlier}()}
|
||||
}
|
||||
\concept{Collaboration}
|
||||
\concept{General}
|
||||
|
|
|
@ -45,8 +45,11 @@ create_fizz(sq_data, metric = "Collaboration_hours", hrvar = "LevelDesignation",
|
|||
}
|
||||
\seealso{
|
||||
Other General:
|
||||
\code{\link{create_bar_asis}()},
|
||||
\code{\link{create_bar}()},
|
||||
\code{\link{create_boxplot}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{create_line_asis}()},
|
||||
\code{\link{create_line}()},
|
||||
\code{\link{create_period_scatter}()},
|
||||
\code{\link{create_rank}()},
|
||||
|
|
|
@ -51,9 +51,12 @@ sq_data \%>\% create_line(metric = "Workweek_span", hrvar = "LevelDesignation")
|
|||
}
|
||||
\seealso{
|
||||
Other General:
|
||||
\code{\link{create_bar_asis}()},
|
||||
\code{\link{create_bar}()},
|
||||
\code{\link{create_boxplot}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{create_fizz}()},
|
||||
\code{\link{create_line_asis}()},
|
||||
\code{\link{create_period_scatter}()},
|
||||
\code{\link{create_rank}()},
|
||||
\code{\link{create_scatter}()},
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/create_line_asis.R
|
||||
\name{create_line_asis}
|
||||
\alias{create_line_asis}
|
||||
\title{Create a line chart without aggregation}
|
||||
\usage{
|
||||
create_line_asis(
|
||||
data,
|
||||
date_var = "Date",
|
||||
metric,
|
||||
title = NULL,
|
||||
subtitle = NULL,
|
||||
caption = NULL,
|
||||
ylab = date_var,
|
||||
xlab = metric,
|
||||
line_colour = rgb2hex(0, 120, 212)
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{data}{Plotting data as a data frame.}
|
||||
|
||||
\item{date_var}{String containing name of variable for the horizontal axis.}
|
||||
|
||||
\item{metric}{String containing name of variable representing the line.}
|
||||
|
||||
\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).}
|
||||
|
||||
\item{line_colour}{String to specify colour to use for the line.
|
||||
Hex codes are accepted. You can also supply
|
||||
RGB values via \code{rgb2hex()}.}
|
||||
}
|
||||
\description{
|
||||
This function creates a line chart directly from the aggregated / summarised data.
|
||||
Unlike \code{create_line()} which performs a person-level aggregation, there is no
|
||||
calculation for \code{create_line_asis()} and the values are rendered as they are passed
|
||||
into the function. The only requirement is that a \code{date_var} is provided for the x-axis.
|
||||
}
|
||||
\seealso{
|
||||
Other General:
|
||||
\code{\link{create_bar_asis}()},
|
||||
\code{\link{create_bar}()},
|
||||
\code{\link{create_boxplot}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{create_fizz}()},
|
||||
\code{\link{create_line}()},
|
||||
\code{\link{create_period_scatter}()},
|
||||
\code{\link{create_rank}()},
|
||||
\code{\link{create_scatter}()},
|
||||
\code{\link{create_stacked}()},
|
||||
\code{\link{cut_hour}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{hrvar_count}()},
|
||||
\code{\link{identify_outlier}()}
|
||||
}
|
||||
\concept{General}
|
|
@ -76,9 +76,12 @@ create_period_scatter(sq_data, before_end = "2019-12-31", return = "table")
|
|||
}
|
||||
\seealso{
|
||||
Other General:
|
||||
\code{\link{create_bar_asis}()},
|
||||
\code{\link{create_bar}()},
|
||||
\code{\link{create_boxplot}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{create_fizz}()},
|
||||
\code{\link{create_line_asis}()},
|
||||
\code{\link{create_line}()},
|
||||
\code{\link{create_rank}()},
|
||||
\code{\link{create_scatter}()},
|
||||
|
|
|
@ -38,9 +38,12 @@ Returns a table with all groups (across multiple HR attributes) ranked by the sp
|
|||
}
|
||||
\seealso{
|
||||
Other General:
|
||||
\code{\link{create_bar_asis}()},
|
||||
\code{\link{create_bar}()},
|
||||
\code{\link{create_boxplot}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{create_fizz}()},
|
||||
\code{\link{create_line_asis}()},
|
||||
\code{\link{create_line}()},
|
||||
\code{\link{create_period_scatter}()},
|
||||
\code{\link{create_scatter}()},
|
||||
|
|
|
@ -58,9 +58,12 @@ create_scatter(sq_data,
|
|||
}
|
||||
\seealso{
|
||||
Other General:
|
||||
\code{\link{create_bar_asis}()},
|
||||
\code{\link{create_bar}()},
|
||||
\code{\link{create_boxplot}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{create_fizz}()},
|
||||
\code{\link{create_line_asis}()},
|
||||
\code{\link{create_line}()},
|
||||
\code{\link{create_period_scatter}()},
|
||||
\code{\link{create_rank}()},
|
||||
|
|
|
@ -73,9 +73,12 @@ sq_data \%>\%
|
|||
}
|
||||
\seealso{
|
||||
Other General:
|
||||
\code{\link{create_bar_asis}()},
|
||||
\code{\link{create_bar}()},
|
||||
\code{\link{create_boxplot}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{create_fizz}()},
|
||||
\code{\link{create_line_asis}()},
|
||||
\code{\link{create_line}()},
|
||||
\code{\link{create_period_scatter}()},
|
||||
\code{\link{create_rank}()},
|
||||
|
|
|
@ -26,9 +26,12 @@ cut_hour(sq_data$Collaboration_hours, cuts = c(10, 15, 20))
|
|||
}
|
||||
\seealso{
|
||||
Other General:
|
||||
\code{\link{create_bar_asis}()},
|
||||
\code{\link{create_bar}()},
|
||||
\code{\link{create_boxplot}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{create_fizz}()},
|
||||
\code{\link{create_line_asis}()},
|
||||
\code{\link{create_line}()},
|
||||
\code{\link{create_period_scatter}()},
|
||||
\code{\link{create_rank}()},
|
||||
|
|
|
@ -30,9 +30,12 @@ sq_data \%>\% extract_hr(return = "vars")
|
|||
}
|
||||
\seealso{
|
||||
Other General:
|
||||
\code{\link{create_bar_asis}()},
|
||||
\code{\link{create_bar}()},
|
||||
\code{\link{create_boxplot}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{create_fizz}()},
|
||||
\code{\link{create_line_asis}()},
|
||||
\code{\link{create_line}()},
|
||||
\code{\link{create_period_scatter}()},
|
||||
\code{\link{create_rank}()},
|
||||
|
|
|
@ -35,9 +35,12 @@ hrvar_count(sq_data, hrvar = "LevelDesignation", return = "table")
|
|||
}
|
||||
\seealso{
|
||||
Other General:
|
||||
\code{\link{create_bar_asis}()},
|
||||
\code{\link{create_bar}()},
|
||||
\code{\link{create_boxplot}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{create_fizz}()},
|
||||
\code{\link{create_line_asis}()},
|
||||
\code{\link{create_line}()},
|
||||
\code{\link{create_period_scatter}()},
|
||||
\code{\link{create_rank}()},
|
||||
|
|
|
@ -42,9 +42,12 @@ identify_outlier(sq_data, metric = "Collaboration_hours")
|
|||
}
|
||||
\seealso{
|
||||
Other General:
|
||||
\code{\link{create_bar_asis}()},
|
||||
\code{\link{create_bar}()},
|
||||
\code{\link{create_boxplot}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{create_fizz}()},
|
||||
\code{\link{create_line_asis}()},
|
||||
\code{\link{create_line}()},
|
||||
\code{\link{create_period_scatter}()},
|
||||
\code{\link{create_rank}()},
|
||||
|
|
|
@ -34,7 +34,6 @@ Other Collaboration:
|
|||
\code{\link{collaboration_line}()},
|
||||
\code{\link{collaboration_rank}()},
|
||||
\code{\link{collaboration_sum}()},
|
||||
\code{\link{collaboration_trend}()},
|
||||
\code{\link{create_dist}()}
|
||||
\code{\link{collaboration_trend}()}
|
||||
}
|
||||
\concept{Collaboration}
|
||||
|
|
Загрузка…
Ссылка в новой задаче