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 therefore NA_logical. haven::labelled() explicitly accepts only character and numeric data types so we don't actually have to account for data values of other data types and can just cast to character 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
Remove failing status 405 test case
Update force_cast() and apply_labs_haven() to fall back to converting to character when non-numeric data types are encountered
Issue Addressed
closes #189
PR Checklist
Before submitting this PR, please check and verify below that the submission meets the below criteria:
[x] New/revised functions have associated tests
[x] New/revised functions that update downstream outputs have associated static testing files (.RDS) updated under inst/testdata/create_test_data.R
[x] New/revised functions use appropriate naming conventions
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