-
- Downloads
fix: var.relations $surr.res returning matrix interspersed with unexpected NA (#4)
This PR fixes an issue where the result of `var.relations` would contain long runs of NA starting in the latter half of variables. This issue caused mean adjusted agreements to be shifted horizontally and across following rows. The issue was caused by setting the mean adjusted agreement of a variable with itself to NA incorrectly. Instead of using the current index, the variable index was used. This resulted in cells being incorrectly overwritten as NA if the variable index was smaller than the number of all variables, and in the implicit addition of NA beyond the end of the vector until the variable index when the variable index was larger than the number of all variables. This caused `mean.index` to return vectors with a length not exactly equal to the number of variables, which in the following steps caused an overrun when the concatenated vectors were being cast to a matrix with dimensions being exactly the length of all variables by all candidate variables. A warning message would appear when this occurred: `data length [...] is not a sub-multiple or multiple of the number of rows [...]`. It did not however notify that extra data was dropped implicitly. This PR also contains some basic test cases for the internal `mean.index` to prevent regression of this issue. - Assert that the length of the return value is always exactly as long as the number of variables - Assert that for unknown variables (that is, variables not represented in `list.res` or `index.variables`) the function will return an NA vector of the appropriate length.
No related branches found
No related tags found
Showing
- NEWS.md 1 addition, 0 deletionsNEWS.md
- R/meanAdjAgree.R 1 addition, 1 deletionR/meanAdjAgree.R
- TROUBLESHOOTING.md 23 additions, 0 deletionsTROUBLESHOOTING.md
- tests/testthat/test-meanAdjAgree_index.mean.R 28 additions, 0 deletionstests/testthat/test-meanAdjAgree_index.mean.R
- tests/testthat/test-testthat.R 0 additions, 3 deletionstests/testthat/test-testthat.R
TROUBLESHOOTING.md
0 → 100644
tests/testthat/test-testthat.R
deleted
100644 → 0
Please register or sign in to comment