shipunov (version 1.13)

Fill: Fill data values downstream, like in spreadsheets

Description

Replaces "ditto" values with preceding values

Usage

Fill(x, ditto="")

Arguments

x

Vector, possibly with missing values

ditto

What to fill, typically empty string "" (default) or NA

Value

Vector with replaced values

See Also

Ditto

Examples

Run this code
# NOT RUN {
aa <- c("a", "a", "", "b", "", "c", "d", "")
Fill(aa)
bb <- c("a", "a", NA, "b", NA, "c", "d", NA)
Fill(bb, ditto=NA)
dd <- c("", "a", "a", "", "", "b", NA, "", "c", "d", "")
Fill(dd)
# }

Run the code above in your browser using DataCamp Workspace