Frequency form to case form - unexpected values in table
The behavior seems to be due to a bug in the expand.dft function. I created a simple function myfun that allows you to create a matrix similar to the one created by expand.dft. 

myfun &lt;- function(x, freq = "Freq") {
  # repeat the row indices according to `freq`
  idx &lt;- rep(seq(nrow(x)), as.integer(x[, freq]))
  # expand matrix and ignore `freq` column
  x[idx, colnames(x) != freq]
}


Note that is function is not meant to replace expand.dft but works for simple cases only.

Try it with your data set rtable:

rtablecase &lt;- myfun(rtable, freq = "freq")


The result:

head(rtablecase)
#   Race    Party
# a "White" "Dem"
# a "White" "Dem"
# a "White" "Dem"
# a "White" "Dem"
# a "White" "Dem"
# a "White" "Dem"