You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into a very unusual bug where calling correctK2() drops rows when called in a specific instance. I have an implementation based on your analysis pipeline, but because I replaced rbind() with dplyr::bind_rows() I ran into this issue
I was able to track the problem down to lines 630 and 632 in the correctK2() function definition where it calls merge(); manually running equivalent code caused merge to behave in the same way. I think this is possibly a bug in the data.table method for merge(), but I'm not totally sure.
If I change only b_kinSelf <- dplyr::bind_rows(b_kinSelf, res$kinSelf) to b_kinSelf <- rbind(b_kinSelf, res$kinSelf), I do not trigger this bug:
The only difference I see between kinself_rbind and kinself_bind_rows is the latter has an extra attribute
> str(kinself_rbind)
Classes ‘data.table’ and 'data.frame': 9093 obs. of 3 variables:
$ ID : chr [redacted]
$ f : num 0.000501 -0.016491 -0.0036 -0.00307 -0.008572 ...
$ nsnp: num 197276 198380 198390 198323 198318 ...
- attr(*, ".internal.selfref")=<externalptr>
> str(kinself_bind_rows)
Classes ‘data.table’ and 'data.frame': 9093 obs. of 3 variables:
$ ID : chr [redacted]
$ f : num 0.000501 -0.016491 -0.0036 -0.00307 -0.008572 ...
$ nsnp: num 197276 198380 198390 198323 198318 ...
- attr(*, ".internal.selfref")=<externalptr>
- attr(*, "sorted")= chr "ID"
> all.equal(kinself_rbind$ID, kinself_bind_rows$ID)
[1] TRUE
> all.equal(kinself_rbind$f, kinself_bind_rows$f)
[1] TRUE
> all.equal(kinself_rbind$nsnp, kinself_bind_rows$nsnp)
[1] TRUE
I know that's a lot of details to throw at you when the bug might be with a dependency, rather than your package, but I wanted to flag it in case there are circumstances where this might commonly crop up. Let me know if there's any other details I can give you and I have this example along with the example data on the Blue Lab servers if @smgogarten wants to take a look
The text was updated successfully, but these errors were encountered:
I was able to reproduce this with a different dataset in the current R version, only in my case, using dplyr::bind_rows results in a 0-element data.frame for res$kinBtwn. I don't see a fix here other than to avoid mixing tidyverse and data.table functions, since I don't understand enough of the inner workings of either package to know how they are conflicting in this case. Possibly the sorted attribute added by dplyr:bind_rows has a different meaning in data.table.
> sessionInfo()
R version 4.2.1 (2022-06-23)
GENESIS_2.27.1
data.table_1.14.4
dplyr_1.0.10
Hi team,
I ran into a very unusual bug where calling
correctK2()
drops rows when called in a specific instance. I have an implementation based on your analysis pipeline, but because I replacedrbind()
withdplyr::bind_rows()
I ran into this issueI was able to track the problem down to lines 630 and 632 in the
correctK2()
function definition where it callsmerge()
; manually running equivalent code caused merge to behave in the same way. I think this is possibly a bug in the data.table method formerge()
, but I'm not totally sure.If I change only
b_kinSelf <- dplyr::bind_rows(b_kinSelf, res$kinSelf)
tob_kinSelf <- rbind(b_kinSelf, res$kinSelf)
, I do not trigger this bug:The only difference I see between
kinself_rbind
andkinself_bind_rows
is the latter has an extra attributeI know that's a lot of details to throw at you when the bug might be with a dependency, rather than your package, but I wanted to flag it in case there are circumstances where this might commonly crop up. Let me know if there's any other details I can give you and I have this example along with the example data on the Blue Lab servers if @smgogarten wants to take a look
The text was updated successfully, but these errors were encountered: