fill_down: Fill Missing Values Down

Description Usage Arguments Details Value Author(s) Examples

Description

fill_down runs through a vector and replaces missing values with the last nonmissing value above it. It can be set to consider only NA or also include empty strings.

Usage

1
fill_down(x, string = FALSE)

Arguments

x

An atomic vector. Often the column of a data frame.

string

when TRUE, fill_down considers "" as missing and is replaced by the last non NA or "" value.

Details

This function is especially useful for filling in values from split cells from an excel file.

Value

An atomic vector

Author(s)

Sven Halvorson (svenedmail@gmail.com)

Examples

1
2
3
test = c(NA, "", NA, NA, "TULAROSA", NA, "RUIDOSO", "", "", NA, "CORONA", NA)
fill_down(test)
fill_down(test, string = TRUE)

svenhalvorson/SvenSFPS documentation built on May 21, 2019, 11:42 a.m.