# This pattern represents 26 weeks of treatment UDS
pattern_char <- "+++++o-------+--+-o-o-o+o+"
pattern2_char <- recode_missing_visits(pattern_char)
# Example 1: a 16 week observation period with visits every 4 weeks
lattice1_char <- "___o___o___o___o"
useLattice1_char <- view_by_lattice(
use_pattern = pattern2_char,
lattice_pattern = lattice1_char
)
useLattice1_char
impute_missing_visits(useLattice1_char, method = "locf", missing_is = "_")
# Example 2: 24 week observation period with weekly visits for the first
# 12 weeks, then monthly visits (during the second week) thereafter
lattice2_char <- "oooooooooooo_o___o___o__"
useLattice2_char <- view_by_lattice(
use_pattern = pattern2_char,
lattice_pattern = lattice2_char
)
useLattice2_char
impute_missing_visits(useLattice2_char, method = "locf", missing_is = "_")
Run the code above in your browser using DataLab