In longitudinal studies it's common that individuals drop out before all responses can be obtained. Measurements obtained before the individual dropped out can be used to impute the unknown measurement(s). The last observation carried forward method is one way to impute values for the missing observations. For the last observation carried forward (LOCF) approach the missing values are replaced by the last observed value of
that variable for each individual regardless of when it occurred.
LOCF() replaces NAs with the most recent non-NA prior to it.
Usage
LOCF(x)
# S3 method for default
LOCF(x)
# S3 method for data.frame
LOCF(x)
# S3 method for matrix
LOCF(x)
Value
a vector with the same dimension as x.
Arguments
x
a vector, a data.frame or a matrix containing NAs.