Hi Jim,

How about expand.grid()?

> expand.grid(c('t01','t02','t03','t04','t05'), 't04')
  Var1 Var2
1  t01  t04
2  t02  t04
3  t03  t04
4  t04  t04
5  t05  t04
> expand.grid(c('t01','t02','t03','t04','t05'), 't01')
  Var1 Var2
1  t01  t01
2  t02  t01
3  t03  t01
4  t04  t01
5  t05  t01

HTH,
Jorge


On Wed, Aug 18, 2010 at 7:44 AM, Maas James Dr (MED) <> wrote:

> I would appreciate any suggestions on which function to use to write
> subsequent functions analysing combinations of treatments.
>
> This refers to experimental trials of medical treatments.  I want to write
> routines to analyse various comparisons (combinations)
>
> So .... if 5 treatments are available (t01, t02, t03, t04 and t05) I want
> to write a general routine that works out all possible combinations, without
> repeats.  The other complication is that I want to be able to designate any
> one of the treatments as the common comparator such that all other
> treatments are compared to it.
>
> For example, if I designate t04 as the common comparator then I want it to
> give me back some sort of vector or matrix with results
>
> t01, t04
> t02, t04
> t03, t04
> t05, t04
>
> In my research I've found functions such as combinations and permutations
> in gtools, and also choose().  I suspect these could be coerced to provide
> the correct output but I may be missing a specific, or more flexible package
> that will produce this.
>
> Any suggestions most welcome.
>
> Thanks
>
> Jim
>
> ===============================
> Dr. Jim Maas
> University of East Anglia
> Norwich, UK
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to