Hi I need some help trying to restructure a data frame:

I have:
food    transaction     quantity
pizza         BUY              5
pizza         SELL              3
apple         BUY              2
orange       SELL              1
pizza         BUY               2


And the data frame I want to make is:

food        BUY          SELL
pizza         7             3
apple         2             0
orange       0             1



I can't figure out the commands to use. Can anyone help?
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Reorganizing-Data-Frame-tp3223863p3223863.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to