View source: R/return_ids_with_LOCF.R
| return_ids_with_LOCF | R Documentation |
To fit the LOCF model, all individuals must have at least one
non-NA entry by landmark time x_L for all covariates.
This function selects these individuals and removes the other rows.
return_ids_with_LOCF( data_long, individual_id, x_L, covariates, covariates_time )
data_long |
Data frame with repeated measurements data in long format |
individual_id |
Character string specifying the column name in |
x_L |
Numeric specifying the landmark time(s) |
covariates |
Vector of character strings specifying the column names in |
covariates_time |
Vector of character strings specifying the column names in |
Individuals have a LOCF if there is a non-NA entry for each of the covariates in
covariates up until (not including) time x_L.
List of data frames which correspond to each landmark time x_L.
Each data frame is an updated version of data_long which contains only rows
of individuals with a LOCF at age x_L, other rows are removed.
Isobel Barrott isobel.barrott@gmail.com
library(Landmarking)
data(data_repeat_outcomes)
data_repeat_outcomes <-
return_ids_with_LOCF(
data_long = data_repeat_outcomes,
individual_id = "id",
covariates =
c("ethnicity", "smoking", "diabetes", "sbp_stnd", "tchdl_stnd"),
covariates_time =
c(rep("response_time_sbp_stnd", 4), "response_time_tchdl_stnd"),
x_L = c(60,61)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.