permutations in R
On Mon, 2009-03-16 at 18:43 -0400, Stavros Macrakis wrote:
Greg,
<snip />
I'm not bringing this up because I am bloody-minded, but because I think it's a serious issue with the R libraries -- there is no obvious
^^^^^^^^^ packages
way to find relevant functions, and no way of knowing which one to use if there is more than one. Or am I missing some trick?
That is what the Task Views are meant to address, for discrete subject areas. Of course, if this particular topic isn't covered then that means no one has yet been stimulated enough to produce one; the task views are all user efforts supported by Achim Zeileis and Kurt Hornik's work on the ctv package providing the R interface to these resources on CRAN. http://cran.at.r-project.org/web/views/ G
Thanks,
-s
On Mon, Mar 16, 2009 at 3:26 PM, Greg Snow <Greg.Snow at imail.org> wrote:
Look at the permutations function in the Combinations package. Using the "fun" argument may accomplish what you want. If not, there are references on the help page to other code that may work for you. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org 801.408.8111
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- project.org] On Behalf Of onyourmark Sent: Friday, March 13, 2009 7:09 PM To: r-help at r-project.org Subject: [R] permutations in R Hi. Does anyone know of a function which will take as input a number n (or a set of n letters) and will give out, one at a time, the permutations of n (or of those n letters) as a vector? So that I can use the permutations one at a time. And such that it will exhaust all the permutations with no repeats. For example if n is 3, I would want a function which I could use in a loop and the first time I use it in the loop it may give the vector 123 and then the next time in the loop it may give 132 and so on until after 6 iterations through the loop I would get all 6 permutations of 123. Thank you. -- View this message in context: http://www.nabble.com/permutations-in-R- tp22507989p22507989.html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ R-help at r-project.org 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.
______________________________________________ R-help at r-project.org 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.
______________________________________________ R-help at r-project.org 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.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090317/d9d433b0/attachment-0003.bin>