If you have a dataframe of factors with the same type of data in each column, then you can just use as.matrix
:
> e=expand.grid(list(letters[1:2],letters[1:3]))
> str(e)
'data.frame': 6 obs. of 2 variables:
$ Var1: Factor w/ 2 levels "a","b": 1 2 1 2 1 2
$ Var2: Factor w/ 3 levels "a","b","c": 1 1 2 2 3 3
- attr(*, "out.attrs")=List of 2
..$ dim : int [1:2] 2 3
..$ dimnames:List of 2
.. ..$ Var1: chr [1:2] "Var1=a" "Var1=b"
.. ..$ Var2: chr [1:3] "Var2=a" "Var2=b" "Var2=c"
> str(as.matrix(e))
chr [1:6, 1:2] "a" "b" "a" "b" "a" "b" "a" "a" "b" "b" "c" "c"
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:2] "Var1" "Var2"