Is it possible to reorder the columns of data frame which is a result of dcast() call E.x.
Given the data:
> dput(copyOfRes)
structure(list(docNa
You can use reorder
here with rev
dcast(copyOfRes, docName ~ reorder(week_number,rev(week_number)), length)
Using week_number as value column: use value.var to override.
docName 11 2
1 doc1 10 0
2 doc2 1 1
You can use factor()
inside dcast()
set appropriate order of levels.
dcast(copyOfRes,
docName ~ factor(week_number,levels=unique(week_number)), length)
docName 11 2
1 doc1 10 0
2 doc2 1 1