locf: Last Observation Carried Forward

Description Usage Arguments Value Author(s) Examples

View source: R/utils.R

Description

Returns the last non-missing observation in a vector.

Usage

1
locf(x)

Arguments

x

vector.

Value

Scalar corresponding to the last non-missing observation.

Author(s)

Antoine Filipovic Pierucci

Examples

1
2
3
4
tab <- data.frame(a1 = c(1, 4, 6),
                  a2 = c(3, NA, NA),
                  a3 = c(4, NA, 5))
apply(tab, 1, locf)

rmngb documentation built on May 29, 2017, 9:22 p.m.

Related to locf in rmngb...