completed_LOCF: Applies an extended LOCF transform to impute missing data

Description Usage Arguments Value Author(s) Examples

Description

Given a vector, applies LOCF transform to this vector to impute missing data and also impute first or last potential missing observations with resp. the first obs. available or the last obs. available depending on the fromLast argument chosen in na.locf.

Usage

1
completed_LOCF(x,fromLast=F)

Arguments

x

a vector with missing data you need to impute

fromLast

Boolean indicating whether we want to apply locf from the first observation (FALSE) or from the last observation (TRUE)

Value

A vector with the same length whose missing data have been imputed with the extended locf method.

Author(s)

Benjamin Schannes

Examples

1
2
3
4
5
## Not run: 
xx <- c(NA,NA,2,3,NA,NA,2,3,NA)
xx <- completed_LOCF(xx,fromLast=F)

## End(Not run)

EpidemiumOpenCancer/OpenCancer documentation built on May 12, 2019, 7:46 a.m.