CHOP-CGTInformatics / REDCapTidieR

Makes it easy to read REDCap Projects into R
https://chop-cgtinformatics.github.io/REDCapTidieR/
Other
33 stars 8 forks source link

Fix non-chr/numeric casting in `apply_labs_haven()` #190

Closed ezraporter closed 6 months ago

ezraporter commented 6 months ago

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 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

Issue Addressed

closes #189

PR Checklist

Before submitting this PR, please check and verify below that the submission meets the below criteria:

Code Review

This section to be used by the reviewer and developers during Code Review after PR submission

Code Review Checklist