1
我正在与一些R的奇怪行为作斗争。有人可以解释发生了什么吗?检查向量中是否存在元素R
在以下示例中,check
是在第一实例中假,并在第二个真实的。为什么seq
与c
不同?
by <- 0.1
percentage <- 60
probs <- seq(0,1,by)
checkValues <- probs * 100
check <- percentage %in% checkValues
probs <- c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1)
checkValues <- probs * 100
check <- percentage %in% checkValues
它越来越更加古怪,仿佛我设置by <- 0.25
和percentage <- 75
都check
属实
'检查< - as.integer( probs * 100)'修好了,谢谢 – barracuda317