# Subject A started Phase I on day 2 and was switched from treatment
# Phase I to Phase II on day 45. Subject B started Phase I on day 6 and
# was never switched to Phase II (either because they dropped out of the
# study or because the treatment given to them in Phase I worked).
rand_df <- data.frame(
who = c("A", "A", "B", "B"),
which = c( 1, 2, 1, 2),
when = c( 2, 45, 6, NA)
)
# Based on this example data above, we expect to see potential contact
# days per the protocol for subject A to range from -30 to 45 + 168.
# For subject B, we expect this range to be from -30 to 6 + 98
CreateCTN30ProtocolHistory(rand_df)
Run the code above in your browser using DataLab