filter_leading_zeros {EpiNow2} | R Documentation |
Filter leading zeros from a data set.
Description
Filter leading zeros from a data set.
Usage
filter_leading_zeros(data, obs_column = "confirm", by = NULL)
Arguments
data |
A |
obs_column |
Character (default: "confirm"). If given, only the column specified here will be used for checking missingness. This is useful if using a data set that has multiple columns of hwich one of them corresponds to observations that are to be processed here. |
by |
Character vector. Name(s) of any additional column(s) where data processing should be done separately for each value in the column. This is useful when using data representing e.g. multiple geographies. If NULL (default) no such grouping is done. |
Value
A data.table with leading zeros removed.
Examples
cases <- data.frame(
date = as.Date("2020-01-01") + 0:10,
confirm = c(0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
)
filter_leading_zeros(cases)