[R] exaustive subgrouping or combination
David Duffy
David.Duffy at qimr.edu.au
Fri Jun 29 23:37:28 CEST 2007
On Fri, 29 Jun 2007, Peter Dalgaard wrote:
> 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]))
>
As I read it, the original query is about partitioning the set eg
((1 2) 3) ((1 3) 2) (1 (2 3)).
--
| David Duffy (MBBS PhD) ,-_|\
| email: davidD at qimr.edu.au ph: INT+61+7+3362-0217 fax: -0101 / *
| Epidemiology Unit, Queensland Institute of Medical Research \_,-._/
| 300 Herston Rd, Brisbane, Queensland 4029, Australia GPG 4D0B994A v
More information about the R-help
mailing list