permute
permute copied to clipboard
Use complete sets automatically when they are small and needed
Should it be useful to switch to shuffleSet(..., control = how(complete = TRUE))
when nperm
is a high proportion of all permutations or in general when the number of all permutations is low? Now automatic setting only happens when the user asks for too many permutations:
> numPerms(7)
[1] 5040
> sum(duplicated(shuffleSet(7, 5041)))
'nperm' > set of all permutations; Resetting 'nperm'.
[1] 0
> sum(duplicated(shuffleSet(7, 5040)))
[1] 1893
## duplicates also with smaller samples
> sum(duplicated(shuffleSet(7, 999)))
[1] 104
Please note also the borderline case of resetting the number of permutations to numPerms(object) - 1
:
> dim(shuffleSet(7, 5040))
[1] 5040 7
> dim(shuffleSet(7, 5041))
'nperm' > set of all permutations; Resetting 'nperm'.
[1] 5039 7
Both of these problems will be avoided if shuffleSet
resets how(complete = TRUE)
if numPerms(object)
is low (say, 50000).