Fix non-chr/numeric casting in apply_labs_haven()
#190
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.
Description
This PR fixes test failures occurring against the development version of
labelled()
.My initial implementation of
apply_labs_haven()
was more general than it needed to be and introduced a test failure on a radio button variable where both the data values and labels are missing and thereforeNA_logical
.haven::labelled()
explicitly accepts onlycharacter
andnumeric
data types so we don't actually have to account for data values of other data types and can just cast tocharacter
when they occur.I also removed a failing test for a specific error message when the API returns status code 405. We were hitting google to generate the status code and it now returns 404. Not sure it's worth testing these.
Proposed Changes
force_cast()
andapply_labs_haven()
to fall back to converting tocharacter
when non-numeric data types are encounteredIssue Addressed
closes #189
PR Checklist
Before submitting this PR, please check and verify below that the submission meets the below criteria:
.RDS
) updated underinst/testdata/create_test_data.R
usethis::use_version()
Code Review
This section to be used by the reviewer and developers during Code Review after PR submission
Code Review Checklist