-
Notifications
You must be signed in to change notification settings - Fork 4
RS-19848: Fix error due to stricter checking in R 4.5.0 #20
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1099,6 +1099,7 @@ datText <- structure(list(Q1_Gender = structure(c(2L, 2L, 1L, 1L, 2L, 2L, | |
| test_that("Many categories", | ||
| { | ||
| expect_error(SankeyDiagram(datText), NA) | ||
| expect_error(SankeyDiagram(datText, link.color = "Last variable"), NA) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it not clear to me how this tests the bug (I'm not familiar with the code)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you look at the CI test results (which are using R 4.5.0), the test fails on the first commit. In terms of the code, the error is in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, thanks. |
||
| }) | ||
|
|
||
| dat.longnames <- structure(list(`D3 - Gender` = structure(c(2L, 1L, 2L, 2L, 2L, | ||
|
|
||
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.
The fix correctly addresses the R 4.5.0 compatibility issue. The original
unlist(links$source, links$target)was invalid syntax -unlist()takes a single list argument, not multiple arguments. Usingc(unlist(links$source), unlist(links$target))properly concatenates the unlisted vectors before finding unique values.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.
Was it broken before? Does it fix a bug that the user would have noticed?
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.
In R 4.4.2 (which we currently use), there's no error but when we migrate to R 4.5.0 an error will be thrown when the user uses the
link.color = "Last variable"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.
Was it working before, i.e.
links$targetwas used? The fix looks fine to me, just curious that it wasn't noticed as a bug.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.
So
num.nodesis being used to initialize the vector, but R is flexible with vector sizing, i.e. you can index beyond the vector length, so there was no bug I think.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.
Yep, I reran the Standard R tests, and there are no diffs so I guess its not that important that
num.nodesis set correctly, but it does make debugging a bit confusing and is probably a bit more inefficient