plot.incidence2()
gains arguments n_breaks
, fill
, show_cases
and
legend
allowing for a wider range of plot styles. See
vignette("incidence2", package = "incidence2")
for examples.interval = "day"
or interval = daily
in a call to incidence
will force the resultant date_index
variable to be a <Date>
. Functionally
this is a wrapper around as.Date()
that ensures the underlying data are
whole numbers and that time zones are respected.incidence()
will now warn if objects are created with columns.
The motivation for this is that, internally, objects are represented
as seconds since the UNIX epoch and, in our experience, this level of
granularity is not normally desired for aggregation.
The by
parameter of complete_dates()
is now defunct. This was previously
passed to an underlying seq
function when, in practice, it should always
have been forced to 1 to match the precision of the underlying date_index.
complete_dates()
will now error if called on an input with a
date_index. Users must now explicitly set the argument allow_POSIXct = TRUE
to maintain old behaviour.
Version 2.0.0 is a major, breaking release of incidence2. We have undertaken a significant refactor that both simplifies the underlying code base and makes the user interface more consistent and robust. Although the main changes are highlighted below, users are strongly advised to read through the accompanying documentation and vignettes.
We no longer support NSE (e.g. tidyselect semantics) within the package. Our motivation for removing support for NSE are both the complexity it can bring to the underlying code (making long term maintenance harder) and the complexity it can cause for other users / developers who want to build on top of incidence2.
new_incidence()
, validate_incidence()
, build_incidence()
, get_n()
,
get_interval()
, get_timespan()
and facet_plot()
are now defunct and
will error if called.
complete_counts()
is now renamed complete_dates()
and gains two new
parameters, expand
and by
. If expand
is TRUE (default) then
complete_dates()
will attempt to use
function(x) seq(min(x), max(x), by = by)
to generate a complete sequence of
dates.
The incidence()
function now always returns output in long format with
dedicated columns for the count variables and values (set by arguments
count_names_to
and count_values_to
).
incidence()
is now less flexible in what it can accept for the interval
argument. For more complex date groupings users are encouraged to perform
their require data transformations prior to calling incidence()
.
The default plotting of incidence objects as been greatly simplified. Sensible defaults have been chosen to enable a quick visual overview of incidence objects but users are advised to call ggplot2 directly for more bespoke plotting.
cumulate()
functionality (previously deprecated in 1.2.0).fill
argument in complete_counts()
is now 0 rather than NA.incidence()
when more than one column was given for the date_index.new_incidence()
: A minimal incidence constructor.validate_incidence()
: Check for internal consistency of incidence-like object.build_incidence()
: Allows you to construct an incidence object whilst specifying
your own date grouping function.format.incidence()
cumulate()
will now give a deprecation error. We have removed the function
to avoid users erroneously regressing against a cumulative count.incidence()
when dates were a character vector and the the
default, daily, interval was specified.dplyr
to handle list based columns (e.g. record-type objects from
vctrs
). For data.frames with only atomic columns, data.table is still used.complete_counts()
.plot()
and facet_plot()
now have a centre_dates
argument which can be
set to FALSE
to get histogram-esque date labels for single month, quarter
and yearweek groupings.Due to multiple changes in the underlying representation of incidence2 objects this release may possibly break old workflows particularly those relying on the old implementations of date grouping:
grates
for
date grouping. This introduces the s3 classes yrwk
, yrmon
, yrqtr
, yr
,
period
and int_period
as well as associated constructors which incidence
now builds upon. As a result of this the
aweek dependency has been dropped.keep_first
and keep_last
functions.incidence
objects now faster due to underlying use of
data.table.show_cases = TRUE
(see #42).count
variable of a pre-aggregated input to
incidence
function.Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.