Skip to content

Commit

Permalink
Fixed current CRAN checks error, and added missing 'F' parameter to t…
Browse files Browse the repository at this point in the history
…arget_capacity
  • Loading branch information
chrismainey committed Dec 14, 2023
1 parent 3a3aeef commit 7851908
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
6 changes: 4 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ Authors@R: c(
person("NHS-R community", email = "[email protected]", role = "cph")
)
Maintainer: Tom Smith <[email protected]>
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
15 changes: 8 additions & 7 deletions R/relief_capacity.R
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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) {
Expand Down
9 changes: 5 additions & 4 deletions R/target_capacity.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion man/relief_capacity.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/target_capacity.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7851908

Please sign in to comment.