decimal_places_df()
function that takes a data
frame and counts the decimal places in all numeric-like columns.is_map_df()
test whether an object is the output of a
scrutiny-style mapper function for consistency tests.is_numeric_like()
function to test
whether an object (e.g., a string vector) can be coerced to
numeric.grim_ratio_upper()
function gives an upper bound
for grim_ratio()
.split_by_parens()
:
The function now uses a cols
argument instead of the
dots (...
). This follows tidyselect
development guidelines. The default,
cols = everything()
, is to select all columns that contain
the sep
elements (by default, parentheses). Set the new
check_sep
argument to FALSE
to select all
columns regardless.
All other arguments were renamed: they no longer start on a dot.
Furthermore, .col1
and .col2
have been renamed
to end1
and end2
.
A warning is now issued if one or more columns can’t be split (or
is de-selected from splitting). This occurs if a column doesn’t contain
the sep
elements.
Internal changes for compatibility with dplyr 1.1.0.
restore_zeros_df()
as well, the dots
(...
) were replaced by a cols
argument, and
each other argument no longer has a prefix dot. This follows the changes
in split_by_parens()
, but note the default selection
restrictions by the new check_numeric_like
argument. The
optional check_decimals
argument goes even further.Some new features and bugfixes:
New audit()
methods for the output of
audit_seq()
and audit_total_n()
.
New duplicate_count_colpair()
function that checks
each combination of columns in a data frame for duplicates.
New restore_zeros_df()
function to easily restore
trailing zeros in all numeric-like columns in a data frame.
New seq_length()
function to extend or shorten
linear sequences.
Bugfixes in the is_seq_*()
functions.
Argument evaluation is now forced in the function factories:
function_map()
, function_map_seq()
, and
function_map_total_n()
.
Some possible corner case issues in
split_by_parens()
are now prevented.
Internal changes for compatibility with purrr 1.0.0 and tidyselect 1.2.0.
This is a patch for CRAN compliance.
The package now requires R version >= 3.4.0 and rlang version >= 1.0.2.
Subtle changes to split_by_parens()
that users
generally won’t notice.
Minor shifts in the documentation (e.g.,
vignette("consistency-tests")
now has instructions on
exporting factory-made functions.).
This is a patch.
It reduces the scope of some examples for CRAN compliance.
Minor vignette changes.
This is a massive release, with many new features and improvements all over scrutiny. Most notably, the package now includes an entirely new system for implementing consistency tests.
grimmer_map_seq()
is analogous to
grim_map_seq()
.grim_map()
no longer includes an items
column by default. Instead, the numbers of items (1 by default) are
factored into the output’s n
column. This focuses the
presentation on the essence of GRIM.function_map()
enables users to quickly create
consistency test functions for data frames much like
grim_map()
or debit_map()
.grim_map_seq()
checks if GRIM inconsistencies might be
due to small errors, and the true values might be close to the reported
ones. It varies the inputs up and down in a specified range, holding the
respective other ones constant, and tests all those combinations. For
summaries, call audit_seq()
on the results.debit_map_seq()
does the same for DEBIT.function_map_seq()
, which
allows users to easily create functions just like these for any
consistency test. All that’s needed is a data-frame-level consistency
testing function like grim_map()
or
debit_map()
.grim_map_total_n()
applies GRIM in cases where no group
sizes are reported, only total sample sizes. It systematically matches
possible group sizes (around half the total) with reported mean or
proportion values, GRIM-tests them, and counts the scenarios in which
both matches are consistent. For summaries, call
audit_total_n()
on the results.debit_map_total_n()
does the same for DEBIT.function_map_total_n()
,
which allows users to easily create new functions like
grim_map_total_n()
or debit_map_total_n()
,
provided a data-frame-level consistency testing function like
grim_map()
or debit_map()
.disperse_total()
takes a total
sample size (comprised of the two unknown group sizes on interest) and
calls the appropriate group-level function: disperse()
for
even totals, disperse2()
for odd ones.seq_disperse()
and seq_disperse_df()
extend scrutiny’s support for string decimal sequences with trailing
zeros. They construct sequences centered around the input; a use case
not directly covered by base::seq()
.is_seq_linear()
test whether
a vector represents a certain kind of numeric sequence.debit_map()
, the x
column is now to the
left of the sd
column if show_rec
is
FALSE
, in accordance with the show_rec = TRUE
default.debit()
is now vectorized.is_subset_of() and is_superset_of()
functions now have
stricter variants grouped around is_proper_subset_of()
and
is_proper_superset_of()
.split_by_parens()
now accepts any pair of separators
passed to .sep
as a length-2 vector.This is a patch, mainly fixing a bug that used to affect the
presentation of input data in grim_map()
’s results. It
needs to be emphasized that this bug only affected a convenience
feature, namely the presentation of certain input data in the output,
not the GRIM test itself.
Previously, if percent
was set to TRUE
,
the x
values were converted to percentages. Because they
need to be presented as strings, percentage conversion involves
restoring the correct number of trailing zeros. The bug, then, was that
all the x
values appearing in the output (not in the
internal computations!) were restored to the same “length” as the single
longest one. This was now remedied, and x
values are
restored to their individually appropriate number of trailing
zeros.
Another bugfix concerns versioning. Previously, the package had an incorrect version number. It was now corrected.
The last change was to remove an outdated and potentially
misleading paragraph in the documentation of
reround_to_fraction()
.
This version includes an overhaul of
grim_plot()
:
It extends the function to cover cases of decimals
values greater than 2, using a gradient instead of a raster.
It enables data-free calls to grim_plot()
with the
new show_data
argument. Resulting plots only display the
background raster. This mirrors Figure 1 in Brown and Heathers’ GRIM
paper. (Although grim_plot()
as a whole is modeled after
this figure, the default addition of empirical summary data is specific
to scrutiny.) Like Brown and Heathers, users may wish to create such
raster-only plots in order to demonstrate some principled points. The
key parameters decimals
and rounding
can be
controlled directly to make up for the lack of information from
data
.
The function now checks if all input means or proportions
(x
) have the same number of decimal places. If they don’t,
it throws an error. This strict criterion can be circumvented by
specifying the decimals
argument. However, since each
raster is specific to one number of decimal places (and hence cannot be
interpreted regarding x
values with a different number),
the recommended solution is to plot x
values separately —
once for each number of decimal places.
The show_full_range
argument was removed because I
now think it is superfluous.
Previously, there was some space between the raster and the y-axis. It has now been removed.
Test result data points, shown in blue and/or red by default, are now built on top of the raster, which makes for a more distinct appearance.
Two new functions, reround_to_fraction()
, and
reround_to_fraction_level()
, enable fractional rounding,
inspired by janitor::round_to_fraction()
. For example, they
might round 0.4
to 0.5
for fractions of
2
. What tells the new functions apart is that they come
with all the flexibility of reround()
. Furthermore,
reround_to_fraction_level()
is closer to a conventional
rounding function than the other two.
The new version also fixes a bug in
row_to_colnames()
, rewriting the function’s core.
Another bug was fixed in grim()
and
grim_map()
, concerning show_rec
: For
rounding
strings that lead to four reconstructed numbers
per x
value rather than just two, it used to be the case
that only the two values corresponding to the first of the two rounding
procedures were displayed in the output tibble. Now, all four are
displayed, bearing appropriate names.
Another bugfix is for the threshold
argument in
reround()
, which didn’t work properly before. This used to
affect higher-level functions such as grim()
,
grim_map()
, debit()
, and
debit_map()
, as well. The default for
threshold
is now 5
in all such functions. Note
that rounding up and down from 5 has been fully functional independently
of it.
Also in reround()
, the rec
argument has
been renamed to x
in accordance with general naming
conventions. The decimals
argument has been renamed to
digits
in accordance with naming conventions among rounding
functions.
In split_by_parens()
, ellipsis support was added to
protect the user from silent, unexpected results following named
arguments in tidy evaluation. The ellipsis package has been added to the
Suggests field in DESCRIPTION
.
In some high-level functions, internal checks now determine if the lengths of multiple arguments that are factored into the same internal function call are mutually congruent. That is, if two such arguments are length > 1, they need to have the same length (which will throw a warning). Otherwise, there will be an explicit and very specific error message.
Finally, some minor refactoring and other small changes that users generally won’t notice.
Related software
.grim_plot()
.NEWS.md
file to track changes to the
package.