I expected that rescale(a_binary_factor, binary.inputs = "-0.5,0.5") would return -0.5 and 0.5, but actually it returns 0.5 and 1.5. According to the R code of rescale(), it converts a binary factor to number (as 1 and 2) by using as.numeric() and then subtracts 0.5 (as 0.5 and 1.5) under recent R version.
It seems that the author incorrectly assumed R convert a binary factor to integer as 0/1 (I'm not sure whether previous R version had such feature), but actually R returns 1/2. Please consider fix this bug. Many thanks.
To reproduce this bug: arm::rescale(gl(2,1), binary.inputs = "-0.5,0.5") # returns c(0.5, 1.5) (R version 4.2.0; Package arm version 1.12-2).
I expected that
rescale(a_binary_factor, binary.inputs = "-0.5,0.5")
would return -0.5 and 0.5, but actually it returns 0.5 and 1.5. According to the R code ofrescale()
, it converts a binary factor to number (as 1 and 2) by usingas.numeric()
and then subtracts 0.5 (as 0.5 and 1.5) under recent R version.It seems that the author incorrectly assumed R convert a binary factor to integer as 0/1 (I'm not sure whether previous R version had such feature), but actually R returns 1/2. Please consider fix this bug. Many thanks.
To reproduce this bug:
arm::rescale(gl(2,1), binary.inputs = "-0.5,0.5") # returns c(0.5, 1.5)
(R version 4.2.0; Package arm version 1.12-2).