Preserve classes when reading from validation_set$values
#539
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR preserves the class of
value
where possible. Two consequences:value
andcolumn
are not of the same class (and thus their interaction is not well defined), the associated warning/error now gets to be produced atinterrogate()
, which shows up at interrogate/report. Using a modified reprex from Evaluation of datetimes not as expected #536:interrogate()
. So if we define the same agent after{lubridate}
has been loaded, we get the more sensible behavior for comparing datetime to date:Implementational details
This PR ensures that reading from
validation_set$values
in the internal functionget_values_at_idx()
preserves class of the values. This is done by simply replacingunlist(recursive = FALSE)
with subsetting[[1]]
to this avoids the attribute-stripping behavior ofunlist()
:Relatedly, the PR also includes a small surgery on
interrogate_set()
to avoid set operation functions since those strip attributes as well. These have been refactored to use subsetting (x[x %in% y]
, etc.).Related GitHub Issues and PRs
value
is stripped of its class in comparison validation functions #537Checklist
testthat
unit tests totests/testthat
for any new functionality.