polish | R Documentation |
Fast algorithm to get rid of transitions to different states occurring at
the same exact time in an augmented data structure as computed by
augment
(see 'Details').
polish(
data,
data_key,
pattern,
time,
check_NA = FALSE,
convert = FALSE,
verbose = TRUE
)
data |
A |
data_key |
A keying variable which |
pattern |
Either an integer, a factor or a character with 2 or 3 unique
values which provides the ID status at the end of the study. |
time |
The target time variable to check duplicates. By default it is set to 'augmented_int'. |
check_NA |
If |
convert |
If |
verbose |
If |
The function finds all those cases where two subsequent events for
a given subject land on different states but occur at the same time.
When this happens, the whole subject, as identified by data_key
, is
removed from the data. The total number of subjects to be removed is
printed out in order to be more informative.
Francesco Grossetti francesco.grossetti@unibocconi.it.
augment
# loading data
data( hosp )
# augmenting longitudinal data
hosp_aug = augment( data = hosp, data_key = subj, n_events = adm_number,
pattern = label_3, t_start = dateIN, t_end = dateOUT,
t_cens = dateCENS )
# cleaning any targeted occurrence
hosp_aug_clean = polish( data = hosp_aug, data_key = subj, pattern = label_3 )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.