View source: R/add_terminal_observations.R
| add_terminal_observations | R Documentation | 
This function adds terminal observations to a dataset.
For each subject given by id, if that subject has less than the maximum
number of observations, A row is added with the end time value, leaving all
other variables as NA.
add_terminal_observations(
  data,
  id,
  time,
  end = max(pull(data, {
     {
         time
     }
 }))
)
| data | A data frame containing the dataset. | 
| id | A variable in  | 
| time | A variable in  | 
| end | The value to use for the  | 
A data frame with terminal observations added.
tidyr::complete()
exdata <- tibble::tibble(
  patient = rep(1:3, 3:5),
  day = c(0, 30, 60,
          0, 30, 60, 90,
          0, 30, 60, 90, 120),
  value = TRUE
)
add_terminal_observations(exdata, patient, day)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.