fill | R Documentation |
Fills missing values in selected columns using the next or previous entry.
fill(.data, ..., direction = "down")
shift_fill(x, direction = "down")
.data |
A data.table |
... |
A selection of columns. |
direction |
Direction in which to fill missing values. Currently either "down" (the default), "up". |
x |
A vector. |
fill
is filling data.table's columns,
shift_fill
is filling any vectors.
A filled data.table
df <- data.table(Month = 1:12, Year = c(2000, rep(NA, 10),2001))
df
df %>% fill(Year)
df <- data.table(Month = 1:12, Year = c(2000, rep(NA, 10),2001))
df %>% fill(Year,direction = "up")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.