Conversation
…ult in R, and add a special round function, to not round to the next even number.
|
I also had to change the This boils down to: which is different to coercing the double result to integer64 for comparison: Is this ok? Or should the calculation in |
| @@ -281,7 +281,7 @@ test_that("sorting methods work", { | |||
| expect_identical(rank(x, method="orderrnk"), x_rank) | |||
|
|
|||
| x = as.integer64(1:100) | |||
There was a problem hiding this comment.
WDYT about
x32 = 100 * (1:100)
x64 = as.integer64(x32)
quantile(x32/100, names=FALSE)
# [1] 1.00 25.75 50.50 75.25 100.00
quantile(x32, names=FALSE)
# [1] 100 2575 5050 7525 10000
quantile(x64, names=FALSE)
# integer64
# [1] 100 2600 5000 7500 10000There was a problem hiding this comment.
That's in main. In this PR the result would be
quantile(x64, names=FALSE)
# integer64
# [1] 100 2575 5050 7525 10000which is what I expect, because it is "identical" to the default behaviour in R. But that depends on the individual view.
When comparing the different modes (type=7 is the default)
setNames(`row.names<-`(Reduce(rbind, lapply(1:9, \(t) quantile(x32, type=t, names=FALSE)), init = data.frame(rep(list(numeric()),5))), c(paste0("type=", 1:9))), names(quantile(x32)))
# 0% 25% 50% 75% 100%
# type=1 100 2500.000 5000 7500.000 10000
# type=2 100 2550.000 5050 7550.000 10000
# type=3 100 2500.000 5000 7500.000 10000
# type=4 100 2500.000 5000 7500.000 10000
# type=5 100 2550.000 5050 7550.000 10000
# type=6 100 2525.000 5050 7575.000 10000
# type=7 100 2575.000 5050 7525.000 10000
# type=8 100 2541.667 5050 7558.333 10000
# type=9 100 2543.750 5050 7556.250 10000it shows, that the results differ alot.
Do we want to support the types 1-9, too? (Right now we only support a non-existent type=0.)
For a consistent median based on qtile it seems, that we "need" a qtile with type=7. Or we implement median independent of quantile.
Or didn't I get your question right? Is it about adjusting the test from 1:100 to your proposal?
medianandquantilehave unexpected results when comparing it withintegertransfered tointeger64.main:
PR:
I had to fix two existing tests.
Closes #247