这个错误带来了很多问题 - 我无法看到相关内容。
我有一个大多数值在±1e9附近的向量,scales::rescale
似乎无法处理它。
require(rescale)
x2 = rescale(x)
# Error in if (zero_range(from) || zero_range(to)) return(rep(mean(to), :
# missing value where TRUE/FALSE needed
# In addition: Warning message:
# In x[1] - x[2] : NAs produced by integer overflow
其他检查:
class(x)
# [1] "integer"
length(x)
# [1] 327117
summary(x)
# Min. 1st Qu. Median Mean 3rd Qu. Max.
# -1.265e+09 -1.113e+09 1.025e+09 4.160e+08 1.034e+09 1.116e+09
range(x)
# [1] -1265205248 1116145571
summary(is.na(x))
# Mode FALSE NA's
# logical 327117 0
plot(sort(x), pch = '.')
似乎没有无效值。我重新创建了一个类似的范围/大小数据集seq()
,但不会杀死rescale
。知道发生了什么事吗?