I'm not entirely sure how these two objects are related. Perhaps give a
little more information on the transform and we can help with
implementation...

For now checkout expand.grid() library(gtools)

Michael Weylandt

On Thu, Sep 29, 2011 at 8:25 AM, Metronome123 <lars.hulze...@gmail.com>wrote:

> Hi,
>
> I have got this start situation:
>
> structure(list(subject = structure(c(1L, 1L, 1L, 1L, 1L, 1L,
> 2L, 2L, 2L, 2L, 2L), .Label = c("s1", "s2"), class = "factor"),
>    part = structure(c(1L, 1L, 2L, 3L, 4L, 5L, 1L, 1L, 2L, 6L,
>    6L), .Label = c("p1", "p2", "p3", "p4", "p5", "p9"), class = "factor"),
>    quality = structure(c(1L, 2L, 1L, 1L, 2L, 3L, 1L, 2L, 1L,
>    1L, 4L), .Label = c("q1", "q2", "q3", "q5"), class = "factor")), .Names
> = c("subject",
> "part", "quality"), class = "data.frame", row.names = c(NA, -11L
> ))
>
> I want to generate all possible configuration combinations i.e. the
> part-quality combinations.
>
> The result should be like this:
>
> structure(list(subject = structure(c(1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L
> ), .Label = c("s1", "s2"), class = "factor"), pq_combination =
> structure(c(1L,
> 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 5L,
> 5L, 5L, 6L, 6L, 6L), .Label = c("pq_1", "pq_2", "pq_4", "pq_5",
> "pq_6", "pq_7"), class = "factor"), part = structure(c(1L, 2L,
> 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 6L, 1L, 2L, 6L, 1L, 2L,
> 6L, 1L, 2L, 6L), .Label = c("p1", "p2", "p3", "p4", "p5", "p9"
> ), class = "factor"), quality = structure(c(1L, 1L, 1L, 2L, 3L,
> 2L, 1L, 1L, 2L, 3L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 4L, 2L, 1L,
> 4L), .Label = c("q1", "q2", "q3", "q5"), class = "factor")), .Names =
> c("subject",
> "pq_combination", "part", "quality"), class = "data.frame", row.names =
> c(NA,
> -22L))
>
> How can I achieve this without complicated loops?
>
> Many thanks in advance!
>
>
> Lars
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Permutations-of-configurations-on-multiple-columns-tp3855495p3855495.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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