I want to do a shuffle on a list of words in R, either using permute::shuffle/shuffleSet()
or any other function.
Code:
require(permute)
a <- c("Ar","Ba","Bl","Bu","Ca")
x <- list(a)
x
shuffleSet(x)
shuffle(x)
But when I try this code I get the error
shuffleSet : Error in seq_len(n) : argument must be coercible to non-negative integer
shuffle : Error in factor(rep(1, n)) :
(list) object cannot be coerced to type 'integer'
Should permute::shuffle/shuffleSet()
only be used only for integers? How do I perform a shuffle for the above list? Is there any other function to do this?
why not use sample?