fix: missing end_hour argument (#180)

Cleaned up parameters in `wellbeing_report()` to make internal function argument values explicit.
This commit is contained in:
Martin Chan 2021-08-25 11:27:21 +01:00
Родитель 2963b43624
Коммит f2d66a7cf9
3 изменённых файлов: 37 добавлений и 10 удалений

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

@ -14,8 +14,14 @@
#' `Organization`.
#' @param mingroup Numeric value setting the privacy threshold / minimum group
#' size. Defaults to 5.
#' @param start_hour A character vector specifying starting hours, e.g. "0900".
#' Note that this currently only supports hourly increments.
#' @param start_hour A character vector specifying starting hours, e.g.
#' `"0900"`. Note that this currently only supports **hourly** increments. If
#' the official hours specifying checking in and 9 AM and checking out at 5
#' PM, then `"0900"` should be supplied here.
#' @param end_hour A character vector specifying starting hours, e.g. `"1700"`.
#' Note that this currently only supports **hourly** increments. If the
#' official hours specifying checking in and 9 AM and checking out at 5 PM,
#' then `"1700"` should be supplied here.
#' @param path Pass the file path and the desired file name, _excluding the file
#' extension_. Defaults to `"wellbeing_report"`.
#'
@ -25,6 +31,7 @@ wellbeing_report <- function(wbq,
hrvar = "Organization",
mingroup = 5,
start_hour = "0900",
end_hour = "1700",
path = "wellbeing_report"
){
@ -45,6 +52,8 @@ wellbeing_report <- function(wbq,
flexdashboard::flex_dashboard(orientation = "columns",
vertical_layout = "fill",
css = system.file("rmd_template/wellbeing/custom.css", package = "wpa")),
start_hour = start_hour # Additional arguments to param
# Additional arguments to param
start_hour = start_hour,
end_hour = end_hour
)
}

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

@ -6,6 +6,7 @@ params:
hrvar: hrvar
mingroup: mingroup
start_hour: start_hour
end_hour: end_hour
title: "`r params$set_title`"
---
@ -32,6 +33,7 @@ my_em_data <- params$hcq
hrvar <- params$hrvar
mingroup <- params$mingroup
start_hour <- params$start_hour
end_hour <- params$end_hour
intro_toc <- readLines("toc.md")
@ -133,14 +135,22 @@ mingroup_str <-
# 4. Compute working patterns list and flexibility index data
wp_list <-
my_em_data %>%
workpatterns_classify(start_hour = start_hour,
return = "list",
hrvar = hrvar)
workpatterns_classify(
start_hour = start_hour,
end_hour = end_hour,
signals = c("email", "IM"),
return = "list",
hrvar = hrvar)
flex_index_data <-
my_em_data %>%
flex_index(return = "data",
hrvar = hrvar)
flex_index(
return = "data",
hrvar = hrvar,
signals = c("email", "IM"),
start_hour = start_hour,
end_hour = end_hour
)
```

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

@ -10,6 +10,7 @@ wellbeing_report(
hrvar = "Organization",
mingroup = 5,
start_hour = "0900",
end_hour = "1700",
path = "wellbeing_report"
)
}
@ -26,8 +27,15 @@ the relevant visual will show up with an indicative message.}
\item{mingroup}{Numeric value setting the privacy threshold / minimum group
size. Defaults to 5.}
\item{start_hour}{A character vector specifying starting hours, e.g. "0900".
Note that this currently only supports hourly increments.}
\item{start_hour}{A character vector specifying starting hours, e.g.
\code{"0900"}. Note that this currently only supports \strong{hourly} increments. If
the official hours specifying checking in and 9 AM and checking out at 5
PM, then \code{"0900"} should be supplied here.}
\item{end_hour}{A character vector specifying starting hours, e.g. \code{"1700"}.
Note that this currently only supports \strong{hourly} increments. If the
official hours specifying checking in and 9 AM and checking out at 5 PM,
then \code{"1700"} should be supplied here.}
\item{path}{Pass the file path and the desired file name, \emph{excluding the file
extension}. Defaults to \code{"wellbeing_report"}.}