[R] Permutations with replacement

Jesse Albert Canchola jesse.canchola.b at bayer.com
Fri Aug 18 22:02:13 CEST 2006


Is there a simple function or process that will create permutations with 
replacement? 

I know that using the combinat package

###### begin R code ######
> library(combinat)
> m <- t(array(unlist(permn(3)), dim = c(3, 6)))

# we can get the permutations, for example 3!=6
# gives us

> m
     [,1] [,2] [,3]
[1,]    1    2    3
[2,]    1    3    2
[3,]    3    1    2
[4,]    3    2    1
[5,]    2    3    1
[6,]    2    1    3
###### end R code ##########

I'd like to include the "with replacement possibilities" such as 

1,1,3
1,1,2
2,3,3

and so on.  This will eventually be done on 8!=40,320 rather than the 
development version using 3! as above.

If no function exists (I've Googled on CRAN with no palpable luck), then 
perhaps this is more of a bootstrap type problem. 

Thanks for your help in advance,
Jesse Canchola










_______________________________________________________________________________________________

The information contained in this e-mail is for the exclusive use of the intended recipient(s) and may be confidential, proprietary, and/or legally privileged.  Inadvertent disclosure of this message does not constitute a waiver of any privilege.  If you receive this message in error, please do not directly or indirectly use, print, copy, forward, or disclose any part of this message.  Please also delete this e-mail and all copies and notify the sender.  Thank you.

For alternate languages please go to http://bayerdisclaimer.bayerweb.com



More information about the R-help mailing list