# NOT RUN {
ltr <- c("a", "b", "c")
x <- permuteWithRepeats(ltr, unique = FALSE)
print(x)
stopifnot(nrow(x) == length(ltr)^length(ltr))
# duplicate results are dropped
y <- permuteWithRepeats(c("X", "Y", "Y"))
print(y)
stopifnot(nrow(y) == 2^3)
z <- permuteWithRepeats(c("X", "Y", "Y", "Y"))
stopifnot(nrow(z) == 2^4)
a <- permuteWithRepeats(c(1, 2, 3, 1))
stopifnot(nrow(a) == 3^4)
# }
Run the code above in your browser using DataLab