My data is set up like this:
PUBLISH_DATE SORT_ORDER Problems
12/01/11 1 Persistent Slabs
12/01/11 2 Wind Slabs
12/02/11 1 Storm Slabs
12/02/11 2 Wind Slabs
12/02/11 3 Persistent Slabs
etc...
What I would like to do is format it like this:
PUBLISH_DATE Sort_Order1 Sort_Order2 Sort_Order3
12/01/11 Persistent Slabs Wind Slabs NA
12/02/11 Storm Slabs Wind Slabs Persistent Slabs
I've used the following to get this output:
new_data <- dcast(test_data, PUBLISH_DATE ~ SORT_ORDER)
which gives me this:
PUBLISH_DATE 1 2 3
12/01/11 1 1 0
12/02/11 1 1 1
But I can't figure out how to replace the number values of each column with the assigned Problem.
HELP?