Буду признателен за любую помощь для подстановки моего sampleDT
ниже в список фреймов данных таким образом, чтобы каждый из фреймов данных в этом списке определялся каждой уникальной комбинацией переменных imput
и draw
. * 1004.*
Подход data_variable <- split(data, data$variable)
, обсуждаемый здесь и здесь , работает только тогда, когда предполагается использовать только одну переменную как правило.В моих анализах у меня может быть более двух переменных, которые можно использовать в качестве правила для поднабора, поэтому решение, которое можно легко адаптировать к более чем двум переменным, будет высоко ценится.
# образец данных
sampleDT<-structure(list(id = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3,
3, 3, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3,
3, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4,
4, 4, 4, 4, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4,
4, 4, 4, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4,
4, 4, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4,
4, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 1,
1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4), imput = c(1,
2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2,
3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3,
4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 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,
0, 0, 0), B = c(1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0,
0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1,
1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1,
1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1,
1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0), Pass = c(278,
278, 278, 278, 278, 100, 100, 100, 100, 100, 153, 153, 153, 153,
153, 79, 79, 79, 79, 79, 278, 278, 278, 278, 278, 100, 100, 100,
100, 100, 153, 153, 153, 153, 153, 79, 79, 79, 79, 79, 278, 278,
278, 278, 278, 100, 100, 100, 100, 100, 153, 153, 153, 153, 153,
79, 79, 79, 79, 79, 278, 278, 278, 278, 278, 100, 100, 100, 100,
100, 153, 153, 153, 153, 153, 79, 79, 79, 79, 79, 278, 278, 278,
278, 278, 100, 100, 100, 100, 100, 153, 153, 153, 153, 153, 79,
79, 79, 79, 79, 278, 278, 278, 278, 278, 100, 100, 100, 100,
100, 153, 153, 153, 153, 153, 79, 79, 79, 79, 79, 278, 278, 278,
278, 278, 100, 100, 100, 100, 100, 153, 153, 153, 153, 153, 79,
79, 79, 79, 79, 278, 278, 278, 278, 278, 100, 100, 100, 100,
100, 153, 153, 153, 153, 153, 79, 79, 79, 79, 79, 278, 278, 278,
278, 278, 100, 100, 100, 100, 100, 153, 153, 153, 153, 153, 79,
79, 79, 79, 79, 278, 278, 278, 278, 278, 100, 100, 100, 100,
100, 153, 153, 153, 153, 153, 79, 79, 79, 79, 79), Fail = c(740,
743, 742, 743, 740, 7581, 7581, 7581, 7581, 7581, 1231, 1232,
1235, 1235, 1232, 1731, 1732, 1731, 1731, 1731, 740, 743, 742,
743, 740, 7581, 7581, 7581, 7581, 7581, 1231, 1232, 1235, 1235,
1232, 1731, 1732, 1731, 1731, 1731, 740, 743, 742, 743, 740,
7581, 7581, 7581, 7581, 7581, 1231, 1232, 1235, 1235, 1232, 1731,
1732, 1731, 1731, 1731, 740, 743, 742, 743, 740, 7581, 7581,
7581, 7581, 7581, 1231, 1232, 1235, 1235, 1232, 1731, 1732, 1731,
1731, 1731, 740, 743, 742, 743, 740, 7581, 7581, 7581, 7581,
7581, 1231, 1232, 1235, 1235, 1232, 1731, 1732, 1731, 1731, 1731,
740, 743, 742, 743, 740, 7581, 7581, 7581, 7581, 7581, 1231,
1232, 1235, 1235, 1232, 1731, 1732, 1731, 1731, 1731, 740, 743,
742, 743, 740, 7581, 7581, 7581, 7581, 7581, 1231, 1232, 1235,
1235, 1232, 1731, 1732, 1731, 1731, 1731, 740, 743, 742, 743,
740, 7581, 7581, 7581, 7581, 7581, 1231, 1232, 1235, 1235, 1232,
1731, 1732, 1731, 1731, 1731, 740, 743, 742, 743, 740, 7581,
7581, 7581, 7581, 7581, 1231, 1232, 1235, 1235, 1232, 1731, 1732,
1731, 1731, 1731, 740, 743, 742, 743, 740, 7581, 7581, 7581,
7581, 7581, 1231, 1232, 1235, 1235, 1232, 1731, 1732, 1731, 1731,
1731), draw = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 8L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L), .Label = c("Weights_1", "Weights_2", "Weights_3",
"Weights_4", "Weights_5", "Weights_6", "Weights_7", "Weights_8",
"Weights_9", "Weights_10"), class = "factor"), weight = c(4,
3, 4, 3, 3, 1, 2, 1, 2, 1, 12, 12, 11, 12, 12, 3, 5, 3, 3, 3,
3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 12, 12, 12, 12, 12, 3, 3, 3, 3,
3, 4, 3, 3, 3, 3, 1, 2, 1, 1, 1, 12, 12, 11, 12, 12, 3, 3, 3,
3, 3, 3, 3, 4, 3, 3, 1, 1, 1, 2, 1, 12, 12, 13, 12, 12, 3, 2,
3, 3, 3, 3, 3, 3, 3, 3, 1, 0, 1, 1, 1, 12, 12, 12, 12, 12, 3,
3, 3, 3, 3, 4, 3, 3, 3, 3, 1, 1, 1, 1, 1, 12, 12, 12, 12, 12,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 12, 12, 12, 12,
12, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 15, 12, 12,
12, 12, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 1, 1, 1, 1, 1, 12, 12,
12, 12, 12, 2, 3, 3, 3, 3, 3, 3, 4, 3, 3, 1, 1, 1, 1, 1, 12,
10, 12, 12, 12, 3, 3, 3, 3, 3)), row.names = c(NA, -200L), class = "data.frame")
Заранее благодарю за любую помощь.