Dear Steven,
The prob package does this, too. (Please see the * fix below).
x <- c(0, 0, 1, 2, 2)
library(prob)
A <- permsn(x, 5) # with repeated columns
B <- unique( data.frame( t(A) )) # no repeated rows
The data frame B will have 56 rows and 5 columns. If you need the
Hi,
If I understand you correctly, there is beta code within the development
version of package 'vegan' on R forge to do this.
install.packages("vegan", repos="http://R-Forge.R-project.org";)
Then:
> numPerms(5)
[1] 120
> perms <- allPerms(5, observed = TRUE)
> perms[1:10,]
[,1] [,2] [,3]
You can use the function permutation from the e1071 package,
then
library(e1071)
multisetperm <- function(multiset) {
unique(apply(matrix(multiset[permutations(length(multiset))],
ncol=length(multiset)), 1, paste, sep="", collapse="")) }
multisetperm(c("0", "0", "1", "2", "2"))
> The output wo
Dear R users,
I want to perform an exact permutation of multisets. I have looked at the
coin package, but it doesn't seem to offer what I am looking for. I want to
perform permutations (exact - without duplications) on multisets of scalars
(e.g., the multiset 0,0,1,2,2). I want to output all the
4 matches
Mail list logo