This approach is similar to Ananda, but uses unlist() instead of factor(as.matrix()) . Since all your columns are already factors, unlist() combine them into one factor vector with the corresponding levels.
So let's see what happens when we unlist() your data frame.
unlist(df, use.names = FALSE) # [1] accbbbbbcaca # Levels: abc
Now we can just run as.integer() (or c() ) in the code above, because the integer values ββof the coefficients match your desired display. Thus, the following will lead to a revision of your entire data frame.
df[] <- as.integer(unlist(df, use.names = FALSE))
Note: use.names = FALSE not required. However, dropping the name attribute will make this process more efficient than not.
Data:
df <- structure(list(V1 = structure(c(1L, 3L, 3L, 2L), .Label = c("a", "b", "c"), class = "factor"), V2 = structure(c(1L, 1L, 1L, 1L ), .Label = "b", class = "factor"), V3 = structure(c(2L, 1L, 2L, 1L), .Label = c("a", "c"), class = "factor")), .Names = c("V1", "V2", "V3"), class = "data.frame", row.names = c(NA, -4L))