JFill: Fill "bad" values in a vector with the most recent "good"...

View source: R/fill.R

JFillR Documentation

Fill "bad" values in a vector with the most recent "good" values

Description

Fill "bad" values in a vector with the most recent "good" values

Usage

JFill(x, badValues = is.na(x), indices = FALSE)

Arguments

x

Vector to be filled

badValues

Logical vector identifying the "bad" values in 'x', i.e. the values to be replaced

indices

If TRUE, return indices into 'x', otherwise values from 'x'.

Value

description Either a vector of indices into 'x' (when 'returnIndices' is 'TRUE'), or 'x' with bad values replaced by the most recent good value.

Examples

JFill(c(NA, 1, 2, 3, NA, 4, NA, NA))
## [1] NA  1  2  3  3  4  4  4


JimMcL/JUtils documentation built on Nov. 7, 2024, 11:25 a.m.