fillDown: Convenience function to fill values down a column

View source: R/misc.R

fillDownR Documentation

Convenience function to fill values down a column

Description

Takes a vector of values and fills any empty strings or NAs with the last non-empty value.

Usage

fillDown(x, emptyStrings = c(NA, ""), errorIfFirstEmpty = TRUE)

Arguments

x

a vector to be filled

emptyStrings

a vector of strings to be considered empty. Defaults to empty string and NA.

errorIfFirstEmpty

if TRUE then throw an error if the first entry is empty

Value

a vector of the same length as x with empty entries filled

Examples

fillDown(c(1:5,NA,NA,6,NA,7))
fillDown(c('a','c','d','Z',NA),'Z')

sherrillmix/dnar documentation built on July 18, 2022, 10:07 p.m.