# This pattern represents 26 weeks of treatment UDS
pattern_char <- "+++++o-------+--+-o-o-o+o+"
# Replace any missing UDS ("o") with positive
cleanPattern_char <- recode_missing_visits(pattern_char)
# Example: detect if the subject was able to stay clean for at least 4
# weeks after randomization but before the end of a 12-week observation
# period
detect_subpattern(
cleanPattern_char,
subpattern = "----",
end = 12
)
# Example: detect if the subject was abstinent during the last 3 weeks
detect_subpattern(
cleanPattern_char,
subpattern = "---",
start = -3,
end = -1
)
Run the code above in your browser using DataLab