expand.grid2() creates a combination data frame from vectors or lists but differs from the original expand.grid() in that it has two options for removing two different type of duplicates. stringsAsFactors is set to TRUE.

expand.grid2(..., rm.dupes = TRUE, rm.dubs = TRUE)

Arguments

...
Vectors, factors, or lists containing vectors.
rm.dupes
Removes duplicated "rows". If TRUE (default) then rows that are unordered duplicates of other rows will be removed. i.e. c("A", "B", "C") is the same as c("C", "B", "A") and any other combination of "A", "B", and "C".
rm.dubs
Removes a row in which all elements are the same. If TRUE (default) then a row such as c("A", "A", "A") will be removed.