[R] expand.grip for permutations
wdunlap at tibco.com
Wed Oct 31 22:24:00 CET 2012
as the argument to expand.grid.
Spotfire, TIBCO Software
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf
> Of trekvana
> Sent: Wednesday, October 31, 2012 1:18 PM
> To: r-help at r-project.org
> Subject: [R] expand.grip for permutations
> if i were to have a block size of 4 people and i want to assign a treatment
> combination to the entire block, there would be 16 different treatment
> combinations (TTTT, TTTP, TTPP, PTTP, etc.)
> i am trying to get all 16 permutations and i am able to use this code below.
> for a block size of 3 the code would be comb=expand.grid(drugs,drugs,drugs)
> and for a block size of 2 it would be comb=expand.grid(drugs,drugs).
> my question is whether there is a way to automatically create the comb
> variable. i tried using expand.grid(rep(drugs, block.size) but that didn't
> any help on how i can proceed? thanks
> View this message in context: http://r.789695.n4.nabble.com/expand-grip-for-
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help