[R] Permutations with replacement

From: Jesse Albert Canchola <jesse.canchola.b_at_bayer.com>
Date: Sat 19 Aug 2006 - 06:25:30 EST


Is there a simple function or process that will create a matrix of 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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat Aug 19 06:32:58 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 19 Aug 2006 - 08:20:50 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.