adheRenceRX (version 1.0.0)

rank_episodes: 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 identify_gaps()

.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

Examples

Run this code
# NOT RUN {
library(adheRenceRX)
library(dplyr)

toy_claims %>% 
  filter(ID == "D") %>% 
  propagate_date() %>% 
  identify_gaps() %>% 
  rank_episodes(.permissible_gap = 20, .initial_rank = 1)
  
# }

Run the code above in your browser using DataLab