Closed vonGameTheory closed 2 years ago
I agree with you. I use zero as a gard to a condition in my algorithm. Perhaps I could change it with NA.
Why NA? Why should it be different than any other number (if constant) when ranking? A constant column of 0s should rank exactly the same as a constant column of 1s or anything else (i.e. the average rank if method is set to average). Otherwise I can't trust the function and have to do a check to make sure I have no columns of all 0s and getting faulty result. (Which is how I discovered bug.)
As I told you, I use zero as a guard condition number. I meed to change my guard with a number that the users want use. NA for the specific algorithm, when not use NA's, it is the best solution.
Στις Κυρ, 7 Φεβ 2021, 00:22 ο χρήστης vonGameTheory < notifications@github.com> έγραψε:
Why NA? Why should it be different than any other number (if constant) when ranking? A constant column of 0s should rank exactly the same as a constant column of 1s or anything else (i.e. the average rank if method is set to average). Otherwise I can't trust the function and have to do a check to make sure I have no columns of all 0s and getting faulty result. (Which is how I discovered bug.)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/RfastOfficial/Rfast/issues/40#issuecomment-774552217, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANPP3FMO3SVBYWIHVD4FDM3S5W6IPANCNFSM4XFOTPMQ .
Oh, so it would fail (or be rank 0s) if input had NAs? That makes sense. But 0s are legit inputs, so should have legit output.
No it would not fail because I have implemented different algorithm for NAs.
Στις Κυρ, 7 Φεβ 2021, 00:33 ο χρήστης vonGameTheory < notifications@github.com> έγραψε:
Oh, so it would fail (or be rank 0s) if input had NAs? That makes sense. But 0s are legit inputs, so should have legit output.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/RfastOfficial/Rfast/issues/40#issuecomment-774553432, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANPP3FP3IV7QJ5AWIECYG63S5W7R5ANCNFSM4XFOTPMQ .
Well, ok, I guess I don't know what you are saying but it should work for 0s!
Describe the bug colRanks ranks columns in a matrix -- if you have a constant column, it should still rank it. It does, unless that constant happens to be zero, and method is set to "average" (the default) Same bug in rowRanks, except for rows.
To Reproduce Steps to reproduce the behavior:
proper behavior
x <- as.matrix(rep(1,5)) # 1 can be any number but 0 here colRanks(x) result: 3 3 3 3 3 (as matrix)
bad behavior
x <- as.matrix(rep(0,5)) # constant column of zeros colRanks(x) result: 0 0 0 0 0
(Same bug for rowRanks if you do that with rows instead of columns)
Expected behavior Second result should also be 3 3 3 3 3 -- a constant column should always get same result, even if it is all 0s.
Desktop (please complete the following information): Rfast v 2.0.1 R version 4.0.3