I've got this data.frame
, ff
:
ff<-data.frame(dest = c("NY", "NY", "LA", "LA"),
st_ti = c("ok", "bad", "ok", "bad"),
qty = c(2,2,2,1))
ff
:
dest st_ti qty
1 NY ok 2
2 NY bad 2
3 LA ok 2
4 LA bad 1
that I would like to expand so it's all categorical data, like this:
gg<-data.frame(dest = c("NY", "NY", "NY", "NY", "LA", "LA","LA"),
st_ti = c("ok", "ok", "bad", "bad", "ok", "ok", "bad"))
gg:
dest st_ti
1 NY ok
2 NY ok
3 NY bad
4 NY bad
5 LA ok
6 LA ok
7 LA bad
I'd like to do something like gather
from the tidyr
package but I don't believe this option is available, here.