keep | R Documentation |
keep_first()
and keep_last()
keep the first and last n
rows to occur
for each grouping when in ascending date order. keep_peaks()
keeps the rows
with the maximum count value for each group. first_peak()
is a convenience
wrapper around keep_peaks()
with the first_only
argument set to TRUE
.
keep_first(x, n, complete_dates = TRUE, ...)
keep_last(x, n, complete_dates = TRUE, ...)
keep_peaks(x, complete_dates = TRUE, first_only = FALSE, ...)
first_peak(x, complete_dates = TRUE, ...)
x |
incidence2 object. |
n |
Number of entries to keep.
|
complete_dates |
Should Defaults to TRUE. |
... |
Other arguments passed to |
first_only |
Should only the first peak (by date) be kept. Defaults to |
incidence2 object with the chosen entries.
if (requireNamespace("outbreaks", quietly = TRUE)) {
data(ebola_sim_clean, package = "outbreaks")
dat <- ebola_sim_clean$linelist
inci <- incidence(dat, "date_of_onset")
keep_first(inci, 3)
keep_last(inci, 3)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.