rank_episodes {adheRenceRX} | R Documentation |
Rank Episodes of Care
Description
This function identifies and labels all episodes of care for a given patient in chronological order. A new episode begins after a specified gap in therapy has occurred.
It is meant to be used after one has appropriately adjusted dates (propagate_date()
) and identified gaps in therapy (identify_gaps()
).
Usage
rank_episodes(.data, .permissible_gap = NULL, .initial_rank = 1)
Arguments
.data |
Data frame with a "gap" column appended from |
.permissible_gap |
Integer value suggesting the maximum gap allowed before labeling a new episode of care |
.initial_rank |
Integer value to identify what the indexing rank should be (defaults to 1). |
Value
The initial claims data frame with an episode
column appended, which ranks episodes of care in time
Note
This function assumes an adjusted_date
column, which is produced by the propagate_date()
function and a
gap
column, which is produced by identify_gaps()
. If you would like to rank episodes of care using other dates and a separate
column for gaps, you'll need to rename those columns before passing the frame to rank_episodes()
. Notably, this is on purpose as this step should
almost always come after the former two.
Examples
library(adheRenceRX)
library(dplyr)
toy_claims %>%
filter(ID == "D") %>%
propagate_date() %>%
identify_gaps() %>%
rank_episodes(.permissible_gap = 20, .initial_rank = 1)