-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fixed an issue of a solitary NA as var_labels passed to analyze #965
base: main
Are you sure you want to change the base?
Conversation
✅ All contributors have signed the CLA |
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @kpagacz for this! I think it makes sense to do it with one line at source instead of spreading it around, also considering that NA_character_ is fine. Could you just add a comment and a regression test for this? Also add NEWS, thanks!! ;)
Added the comment, test and the NEWS entry. Ready for re-review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @kpagacz! Great work
Hi @kpagacz , thanks a lot for the PR! great change! thanks a lot. no concerns from my side. I have a question to @pawelru , I was wondering if r-deps allow us to trigger downstream package checks before we merge?
i was wondering should we do the same by modifying the github action check.yml to trigger the downstream cicd tests? |
Here's an MRE of the issue:
which results in:
R treats a single NA as a logical vector, which fails the validation on the
Split
object, which requires the labels slot to be a character vector. This issue does not happen when the var_labels array contains other character values. The untyped NAs are cast to characters automatically in this case.This also does not happen in this scenario:
What prompted this is the investigation of what happens when launching the below teal application:
This application errors out with the above rtables error, because the application tries to evaluate the below:
This fails due to solitary NA in the
analyze_vars
call, passed directly tortables::analyze
.Unfortunately, trying to fix the issue on the
teal.modules.clinical
side is unsuccessful due to howsubstitute
treats such solitary NAs (basically casting them from the explicit NA_character_ to normal NA). The fix could be made on the level oftern
, but it seems silly not to go to the bottom, which isrtables::analyze
, and deeper - AnalyzeMultiVars, etc...Let me know if this makes sense for you or if you would like me to take a different route.