Things under legendu
expand.gridcreates a data frame from all possible combinations of supplied vectors or factors. For example,> expand.grid(letters[1:2], 1:3, c("+", "-")) Var1 Var2 Var3 1 a 1 + 2 b 1 + 3 a 2 + 4 b 2 + 5 a 3 + 6 b 3 + 7 a 1 - 8 b 1 - 9 a 2 - 10 b 2 - 11 a 3 - 12 b 3 -combngenerates all combinations of elements taking at a time.