Skip to content

Expose REDCapR col_types#238

Merged
rsh52 merged 7 commits intomainfrom
expose-col_types
Dec 31, 2025
Merged

Expose REDCapR col_types#238
rsh52 merged 7 commits intomainfrom
expose-col_types

Conversation

@rsh52
Copy link
Copy Markdown
Collaborator

@rsh52 rsh52 commented Dec 31, 2025

Description

This PR seeks to allow users access to the col_types parameter. This will help with tackling cases where REDCapR/readr do not correctly guess the data type of outputs. This only seems to happen in niche instances, and was brought to our attention in the example of a radio button/single selection field for M/F/Unk where all entered data was "F", resulting in an incorrect application of T/F for the field type.

Proposed Changes

List changes below in bullet format:

Issue Addressed

Closes #236

PR Checklist

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

  • [NA] New/revised functions have associated tests
    • Assumed unnecessary since this is a core feature of REDCapR
  • [NA] New/revised functions that update downstream outputs have associated static testing files (.RDS) updated under inst/testdata/create_test_data.R
  • New/revised functions use appropriate naming conventions
  • New/revised functions don't repeat code
  • Code changes are less than 250 lines total
  • Issues linked to the PR using GitHub's list of keywords
  • The appropriate reviewer is assigned to the PR
  • The appropriate developers are assigned to the PR
  • Pre-release package version incremented using usethis::use_version()

Code Review

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

Code Review Checklist

  • I checked that new files follow naming conventions and are in the right place
  • I checked that documentation is complete, clear, and without typos
  • I added/edited comments to explain "why" not "how"
  • I checked that all new variable and function names follow naming conventions
  • I checked that new tests have been written for key business logic and/or bugs that this PR fixes
  • I checked that new tests address important edge cases

Introduces a new `col_types` parameter to the `read_redcap` function, allowing users to specify column types via a readr::cols() object. Updates documentation and Rd files to reflect this addition. Also includes minor documentation corrections, code style improvements (removing unnecessary return statements), and updates to the vignette and test snapshots.
Expanded documentation for the col_types argument in read_redcap, including new sections in both R and Rd files to guide users on specifying column types. Enhanced warning messages in checks.R to suggest using col_types for correcting unexpected data types. Updated utility/refresh.R to exclude pipe_consistency_linter from checks.
Incremented package version to 1.2.4.9002 and updated NEWS.md to document the exposure of the `col_types` parameter from REDCapR, allowing manual specification of expected data type outputs.
@rsh52 rsh52 self-assigned this Dec 31, 2025
@rsh52 rsh52 added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request labels Dec 31, 2025
@rsh52 rsh52 requested a review from ezraporter December 31, 2025 19:20
@rsh52 rsh52 marked this pull request as ready for review December 31, 2025 19:20
Copy link
Copy Markdown
Collaborator

@ezraporter ezraporter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One suggested change to the docs if you want it but I support merging as is too. Thanks for all the additional clean up as well!

Comment thread R/read_redcap.R Outdated
rsh52 and others added 4 commits December 31, 2025 15:02
Co-authored-by: Ezra Porter <60618324+ezraporter@users.noreply.github.com>
@rsh52
Copy link
Copy Markdown
Collaborator Author

rsh52 commented Dec 31, 2025

Awesome, thanks!

@rsh52 rsh52 merged commit bf1c26d into main Dec 31, 2025
4 checks passed
@rsh52 rsh52 deleted the expose-col_types branch December 31, 2025 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] read_redcap Can Assume Incorrect Column Types

2 participants