Fill missing values in a vector
fill_in.Rd
This function takes a vector containing missing values ("" or NA), and overwrites empty positions with the previous non-missing entry. This assumes the first value is not a missing value.
Details
The motivating example for this was to automatically fill in cells in BODC nutrient data where metadata is not copied past the first row of a block of data representing a single CTD cast.
Examples
# Create dummy data with missing entries
test <- c(1, 2, "", "", NA, 3, "")
# Replace blanks
filled <- fill_in(test)