merge_to_episode: Merge to episode

Description Usage Arguments Value Examples

View source: R/merge_to_episode.R

Description

Merge information back to treatment episodes based on patient ID numbers and dates.

Usage

1
2
3
4
5
6
7
8
merge_to_episode(
  df_episode,
  df_info,
  key_var,
  start_date,
  eval_date,
  post_start = FALSE
)

Arguments

df_episode

data frame containing episode data - each row is expected to have a unique treatment episode

df_info

data frame containing baseline information related to specific treatment episodes. Each row should have a unique collection date for each patient

key_var

bare name of the key variable linking the two data frames - normally patient_id

start_date

bare name of start episode variable in df_episode

eval_date

bare name of collection date variable in df_info

post_start

boolean flag to indicate whether information is entered after start of episode - e.g. treatment outcome.

Value

data frame with information attached to each treatment episode. Information is selected based on date of collection such that the closest information prior to the episode starting is selected

Examples

1
2
3
4
5
6
7
8
## Not run: 
merge_to_episode(df_episode = start,
df_info = reg, 
key_var = id, 
start_date = sdate,
eval_date = reg_date)

## End(Not run)

JayAchar/hisreportr documentation built on March 18, 2020, 5:57 a.m.