Possible Duplicate:
Reshape data from long to wide format R
With:
day <- c(1, 1, 2, 2)
prod <- c(1, 2, 1, 2)
cost <- c(20.1, 17.7, 15.2, 23.3)
record <- data.frame(day=day, prod=prod, cost=cost)
record
day prod cost
1 1 1 20.1
2 1 2 17.7
3 2 1 15.2
4 2 2 23.3
What is a good (quick) way to reshape the data as:
day_1 day_2
prod_1 20.1 15.2
prod_2 17.7 23.3
Thanks!