View source: R/misc functions.R
fill_in | R Documentation |
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.
fill_in(data)
data |
a vector containing "" or NA as missing values. |
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.
A filled in vector where "" or NA is replaced with the latest non-missing value.
# Create dummy data with missing entries test <- c(1, 2, "", "", NA, 3, "") # Replace blanks filled <- fill_in(test)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.