I wanted to shuffle characters in all strings by all means, I used the command:
string <- "hello"
all_permutations <- gtools::permutations(nchar(string), nchar(string), string)
strings <- c("hello", "world", "bing")
for (string in strings) {
all_permutations <- gtools::permutations(nchar(string), nchar(string), string)
print(all_permutations)
}
But I got an error:
all_permutations <- gtools::permutations(nchar(string), nchar(string), string)
Error in gtools::permutations(nchar(string), nchar(string), string) :
v is either non-atomic or too short
Currently I don't know how to handle it, thank you for your help.