R 带有'的bug;独特的';?Don';当';nmax';比唯一值的数目少1

R 带有'的bug;独特的';?Don';当';nmax';比唯一值的数目少1,r,vector,unique,R,Vector,Unique,我们已经在R3.5.0上对此进行了测试 set.seed(0) x <- rexp(100) length(unique(x)) ## 100 ## this fails as I expect unique(x, nmax = 98) #Error in unique.default(x, nmax = 98) : hash table is full ## but how come does this succeed? length(unique(x, nmax = 99))

我们已经在R3.5.0上对此进行了测试

set.seed(0)
x <- rexp(100)
length(unique(x))  ## 100

## this fails as I expect
unique(x, nmax = 98)
#Error in unique.default(x, nmax = 98) : hash table is full

## but how come does this succeed?
length(unique(x, nmax = 99))  ## 100
set.seed(0)

x与复制的函数
具有相同的行为。为什么只在
长度中包装第二个调用?我想如果在调用unique的两种情况下都使用
length
,或者在两种情况下都不使用,那么这一点会更清楚,因为nmax为98&99,这是我能提供的最好的方法
nmax-1
仍然返回向量的长度,因此我认为忽略它是正确的。@Anonymouscoward谢谢。现在
factor
也有同样的问题。我想任何调用
duplicated
的东西都有问题。