wl_queue_size {NHSRwaitinglist} | R Documentation |
Queue size calculator
Description
Calculates queue sizes from a waiting list
Usage
wl_queue_size(
waiting_list,
start_date = NULL,
end_date = NULL,
referral_index = 1,
removal_index = 2
)
Arguments
waiting_list |
data.frame consisting addition and removal dates |
start_date |
Date or character (in format 'YYYY-MM-DD'); start of calculation period |
end_date |
Date or character (in format 'YYYY-MM-DD'); end of calculation period |
referral_index |
the index of referrals in waiting_list |
removal_index |
the index of removals in waiting_list |
Value
A data.frame containing the size of the waiting list for each day in
the specified date range. If start_date
and/or end_date
are
NULL
, the function uses the earliest and latest referral dates in
the input data.frame. The returned data.frame has the following columns:
- dates
Date. Each date within the computed range, starting from the first referral.
- queue_size
Numeric. Number of patients on the waiting list on that date.
Examples
referrals <- c.Date("2024-01-01", "2024-01-04", "2024-01-10", "2024-01-16")
removals <- c.Date("2024-01-08", NA, NA, NA)
waiting_list <- data.frame("referral" = referrals, "removal" = removals)
wl_queue_size(waiting_list)
[Package NHSRwaitinglist version 0.1.2 Index]