I am trying to split a data frame into a list. This question was helpful, but I also want to drop the column used for grouping, since it will mess up future steps. The drop
argument for split
only applies to unused levels. The data frame is as follows:
structure(list(Var1 = c(-1L, -1L, -1L, -1L, -1L, -1L, -1L, -1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, -1L, -1L, -1L,
-1L, -1L, -1L, -1L, -1L),
Var2 = c(-1L, -1L, -1L, -1L, 0L, -1L, -1L, -1L, 0L,
0L, 0L, -1L, -1L, -1L, -1L, -1L, -1L, -1L,
-1L, -1L, -1L, -1L, -1L, -1L, -1L, -1L, -1L,
-1L, -1L, -1L, -1L, -1L, -1L, -1L, -1L),
Var3 = c(1L, -1L, -1L, -1L, -1L, -1L, -1L, -1L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 1L, 1L, 0L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, -1L, -1L, -1L, -1L,
-1L, -1L, -1L, -1L),
Var4 = c(1L, -1L, -1L, 2L, -1L, -1L, -1L, 1L, 1L, 1L,
1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 1L, -1L, -1L, -1L, -1L,
-1L, -1L, -1L, -1L),
Var5 = c(1L, -1L, -1L, 2L, -1L, -1L, -1L, 2L, 1L, 1L,
1L, 1L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L,
0L, 0L, 1L, 1L, 1L, 1L, -1L, -1L, -1L, -1L,
-1L, -1L, -1L, -1L),
Bin = c(1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 5L, 6L, 6L,
7L, 7L, 8L, 8L, 9L, 9L, 10L, 10L, 11L, 11L,
12L, 12L, 13L, 13L, 14L, 14L, 15L, 15L, 16L,
16L, 17L, 17L, 18L, 18L)),
.Names = c("Var1", "Var2", "Var3", "Var4", "Var5", "Bin"),
class = "data.frame", row.names = c(NA, -35L))
How can I split this by "Bin" while dropping "Bin"?