rank_episodes {adheRenceRX}R Documentation

Rank Episodes of Care


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()).


rank_episodes(.data, .permissible_gap = NULL, .initial_rank = 1)



Data frame with a "gap" column appended from identify_gaps()


Integer value suggesting the maximum gap allowed before labeling a new episode of care


Integer value to identify what the indexing rank should be (defaults to 1).


The initial claims data frame with an episode column appended, which ranks episodes of care in time


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.



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

[Package adheRenceRX version 1.0.0 Index]