[R] exaustive subgrouping or combination

Peter Dalgaard p.dalgaard at biostat.ku.dk
Fri Jun 29 08:46:50 CEST 2007


David Duffy wrote:
>> Waverley <waverley.paloalto at gmail.com> asked:
>>
>> Dear Colleagues,
>>
>> I am looking for a package or previous implemented R to subgroup and
>> exaustively divide a vector of squence into 2 groups.
>>
>> -- 
>> Waverley @ Palo Alto
>>     
>
> Google "[R] Generating all possible partitions" and you will find some R code
> from 2002 or so.
>
>   
In 2002 this wasn't already in R. These days, help(combn) is more to the 
point:

 mn <- sort(zapsmall(combn(sleep$extra,10,mean)))
 plot(unique(mn),table(mn))
 abline(v=mean(sleep$extra[1:10]))



More information about the R-help mailing list