From 7851908899392e346efdd9b93b96a5960771ef98 Mon Sep 17 00:00:00 2001 From: Chris Mainey Date: Thu, 14 Dec 2023 16:27:46 +0000 Subject: [PATCH] Fixed current CRAN checks error, and added missing 'F' parameter to target_capacity --- DESCRIPTION | 6 ++++-- R/relief_capacity.R | 15 ++++++++------- R/target_capacity.R | 9 +++++---- man/relief_capacity.Rd | 3 ++- man/target_capacity.Rd | 2 ++ 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 55b512a..cf21125 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -12,13 +12,15 @@ Authors@R: c( person("NHS-R community", email = "nhs.rcommunity@nhs.net", role = "cph") ) Maintainer: Tom Smith -Description: R-package to implement the waiting list management approach described in this paper by Fong et al 2022 +Description: R-package to implement the waiting list management approach described in this paper by Fong et al 2022. License: MIT + file LICENSE Encoding: UTF-8 Roxygen: list(markdown = TRUE) RoxygenNote: 7.2.3 Suggests: knitr, - rmarkdown + rmarkdown, + testthat (>= 3.0.0) VignetteBuilder: knitr URL: https://nhs-r-community.github.io/NHSRwaitinglist/ +Config/testthat/edition: 3 diff --git a/R/relief_capacity.R b/R/relief_capacity.R index 4095a8c..0c0758e 100644 --- a/R/relief_capacity.R +++ b/R/relief_capacity.R @@ -1,10 +1,10 @@ #' @title Relief Capacity #' #' @description -#' Calculates required relief capacity to achieve target queue size in a given period of time as a function of demand, queue size, target queue size and time period. -#' +#' Calculates required relief capacity to achieve target queue size in a given period of time as a function of demand, queue size, target queue size and time period. +#' #' Relief Capacity is required if Queue Size > 2 * Target Queue Size. -#' +#' #' Relief Capacity = Current Demand + (Queue Size - Target Queue Size)/Time Steps #' #' @param demand Numeric value of rate of demand in same units as target wait - e.g. if target wait is weeks, then demand in units of patients/week. @@ -15,11 +15,12 @@ #' @return A numeric value of the required rate of capacity to achieve a target queue size in a given period of time. #' @export #' -#' @examples -#' # If demand is 30 patients per week, the current queue size is 1200 and the target is to achieve a queue size of 390 in 26 weeks, then -#' +#' @examples +#' # If demand is 30 patients per week, the current queue size is 1200 and the +#' # target is to achieve a queue size of 390 in 26 weeks, then +#' #' # Relief Capacity = 30 + (1200 - 390)/26 = 61.15 patients per week. -#' +#' #' relief_capacity(30, 1200, 390, 26) #' relief_capacity <- function(demand, queue_size, target_queue_size, weeks_to_target) { diff --git a/R/target_capacity.R b/R/target_capacity.R index 7c73a55..95928b3 100644 --- a/R/target_capacity.R +++ b/R/target_capacity.R @@ -2,22 +2,23 @@ #' #' @description #' Calculates the target capacity to achieve a given target waiting time as a function of observed demand, target waiting time and a variability of demand parameter F. -#' +#' #' F defaults to 1. -#' +#' #' Target Capacity = Demand + 2 * ( 1 + 4 * F ) / Target Wait #' #' @param demand Numeric value of rate of demand in same units as target wait - e.g. if target wait is weeks, then demand in units of patients/week. #' @param target_wait Numeric value of number of weeks that has been set as the target within which the patient should be seen. +#' @param F Holding value, needs definition of F adding. #' #' @return A numeric value of target capacity required to achieve a target waiting time. #' @export #' #' @examples -#' +#' #' # If the target wait is 52 weeks, demand is 30 patients per week and F = 3 then #' # Target capacity = 30 + 2*(1+4*3)/52 = 30.5 patients per week. -#' +#' #' target_capacity(30,52,3) #' target_capacity <- function(demand, target_wait, F = 1) { diff --git a/man/relief_capacity.Rd b/man/relief_capacity.Rd index 25f730e..caae962 100644 --- a/man/relief_capacity.Rd +++ b/man/relief_capacity.Rd @@ -26,7 +26,8 @@ Relief Capacity is required if Queue Size > 2 * Target Queue Size. Relief Capacity = Current Demand + (Queue Size - Target Queue Size)/Time Steps } \examples{ -# If demand is 30 patients per week, the current queue size is 1200 and the target is to achieve a queue size of 390 in 26 weeks, then +# If demand is 30 patients per week, the current queue size is 1200 and the +# target is to achieve a queue size of 390 in 26 weeks, then # Relief Capacity = 30 + (1200 - 390)/26 = 61.15 patients per week. diff --git a/man/target_capacity.Rd b/man/target_capacity.Rd index 84d8cc3..05d379a 100644 --- a/man/target_capacity.Rd +++ b/man/target_capacity.Rd @@ -10,6 +10,8 @@ target_capacity(demand, target_wait, F = 1) \item{demand}{Numeric value of rate of demand in same units as target wait - e.g. if target wait is weeks, then demand in units of patients/week.} \item{target_wait}{Numeric value of number of weeks that has been set as the target within which the patient should be seen.} + +\item{F}{Holding value, needs definition of F adding.} } \value{ A numeric value of target capacity required to achieve a target waiting time.