Only for `identify_shifts_wp()`
This commit is contained in:
Martin Chan 2021-06-30 14:29:42 +01:00
Родитель 7877b1f712
Коммит 0b2346e302
2 изменённых файлов: 16 добавлений и 2 удалений

Просмотреть файл

@ -25,6 +25,9 @@
#' @param percent Logical value to determine whether to show labels as
#' percentage signs. Defaults to `FALSE`.
#'
#' @param n Numeric value specifying number of shifts to show. Defaults to 10.
#' This parameter is only used when `return` is set to `"plot"`,
#'
#' @inheritParams workpatterns_classify_bw
#'
#' @return
@ -47,6 +50,9 @@
#' # Return plot
#' em_data %>% identify_shifts_wp()
#'
#' # Return plot - showing percentages
#' em_data %>% identify_shifts_wp(percent = TRUE)
#'
#' # Return table
#' em_data %>% identify_shifts_wp(return = "table")
#'
@ -58,6 +64,7 @@ identify_shifts_wp <- function(data,
start_hour = 9,
end_hour = 17,
percent = FALSE,
n = 10,
return = "plot"){
## Remove case-sensitivity for signals
@ -158,11 +165,11 @@ identify_shifts_wp <- function(data,
}
} %>%
arrange(desc(WeekCount)) %>%
utils::head(10) %>%
utils::head(n) %>%
create_bar_asis(group_var = "Shifts",
bar_var = "WeekCount",
title = "Most frequent shifts",
subtitle = "Showing top 10 only",
subtitle = paste("Showing top", n),
caption = extract_date_range(data, return = "text"),
ylab = "Shifts",
xlab = "Frequency",

Просмотреть файл

@ -11,6 +11,7 @@ identify_shifts_wp(
start_hour = 9,
end_hour = 17,
percent = FALSE,
n = 10,
return = "plot"
)
}
@ -43,6 +44,9 @@ then \code{"1700"} should be supplied here.}
\item{percent}{Logical value to determine whether to show labels as
percentage signs. Defaults to \code{FALSE}.}
\item{n}{Numeric value specifying number of shifts to show. Defaults to 10.
This parameter is only used when \code{return} is set to \code{"plot"},}
\item{return}{String specifying what to return. This must be one of the
following strings:
\itemize{
@ -79,6 +83,9 @@ be compared to gauge the accuracy of existing Outlook settings.
# Return plot
em_data \%>\% identify_shifts_wp()
# Return plot - showing percentages
em_data \%>\% identify_shifts_wp(percent = TRUE)
# Return table
em_data \%>\% identify_shifts_wp(return = "table")