Re: [R] Working with combinations

2010-03-08 Thread Erich Neuwirth
and 2,5). Am I overlooking something that makes it produces all of the combinations? From: Erich Neuwirth erich.neuwi...@univie.ac.at To: Herm Walsh hermwa...@yahoo.com; r-help r-help@r-project.org Sent: Sat, March 6, 2010 9:12:13 AM Subject: Re: [R] Working with combinations

Re: [R] Working with combinations

2010-03-06 Thread Herm Walsh
: Wed, March 3, 2010 2:10:34 PM Subject: Re: [R] Working with combinations The following code takes a combination of type n over k represented by an increasing sequence as input an produces the lexicographically next combinations. So you can single step through all possible combinations and apply

Re: [R] Working with combinations

2010-03-06 Thread Erich Neuwirth
...@univie.ac.at To: Herm Walsh hermwa...@yahoo.com Cc: David Winsemius dwinsem...@comcast.net; r-help@r-project.org Sent: Wed, March 3, 2010 2:10:34 PM Subject: Re: [R] Working with combinations The following code takes a combination of type n over k represented by an increasing sequence as input

Re: [R] Working with combinations

2010-03-06 Thread Herm Walsh
it produces all of the combinations?   From: Erich Neuwirth erich.neuwi...@univie.ac.at Sent: Sat, March 6, 2010 9:12:13 AM Subject: Re: [R] Working with combinations currCombin - c(1,2) #this is the first possible combination 2 out if 5. Since the vector has

Re: [R] Working with combinations

2010-03-03 Thread Herm Walsh
Thanks David for the thoughts.  The challenge I have with this approach is that the criteria I have is defined by a series of tests--which I do not think I could substitute in in place of the logical indexing. In the combinations code I was hoping there is a step where, each new combination is

Re: [R] Working with combinations

2010-03-03 Thread David Winsemius
On Mar 3, 2010, at 12:35 PM, Herm Walsh wrote: Thanks David for the thoughts. The challenge I have with this approach is that the criteria I have is defined by a series of tests--which I do not think I could substitute in in place of the logical indexing. In the combinations code I was

Re: [R] Working with combinations

2010-03-03 Thread Erich Neuwirth
The following code takes a combination of type n over k represented by an increasing sequence as input an produces the lexicographically next combinations. So you can single step through all possible combinations and apply your filter criteria before you produce the next combination.

[R] Working with combinations

2010-03-02 Thread Herm Walsh
I am working with the combinations function (available in the gtools package).  However, rather than store all of the possible combinations I would like to check each combination to see if it meets a certain criteria.  If it does, I will then store it. I have looked at the combinations code

Re: [R] Working with combinations

2010-03-02 Thread Duncan Temple Lang
I think there are several packages that implement combinations and several that allow you to specify a function to be called when each vector of combinations is generated. I can't recall the names of all such packages, but the Combinations package on www.omegahat.org/Combinations is one. D.

Re: [R] Working with combinations

2010-03-02 Thread David Winsemius
On Mar 2, 2010, at 9:15 PM, Herm Walsh wrote: I am working with the combinations function (available in the gtools package). However, rather than store all of the possible combinations I would like to check each combination to see if it meets a certain criteria. If it does, I will then