wl_insert {NHSRwaitinglist} | R Documentation |
Insert new referrals into the waiting list
Description
Adds new referrals, with other columns set as NA
.
Usage
wl_insert(waiting_list, additions, referral_index = 1)
Arguments
waiting_list |
data.frame. A df of referral dates and removals |
additions |
Character or Date vector. A list of referral dates to add to the waiting list |
referral_index |
The index of the column in |
Value
A data.frame
representing the updated waiting list,
with additional referrals dates in the column specified by
referral_index
. Other columns are filled with NA
in the
new rows. The result is sorted by the referral column.
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)
additions <- c.Date("2024-01-03", "2024-01-05", "2024-01-18")
longer_waiting_list <- wl_insert(waiting_list, additions)
[Package NHSRwaitinglist version 0.1.1 Index]