Learn R Programming

shipunov (version 1.17.1)

Fill: Fill data values downstream, like in spreadsheets

Description

Replaces "ditto" values with preceding values

Usage

Fill(x, ditto="")

Value

Vector with replaced values

Arguments

x

Vector, possibly with missing values

ditto

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

Author

Alexey Shipunov

See Also

Ditto

Examples

Run this code
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 DataLab