I am new to "R", I need to convert rows to columns Source is saved in data frame
What i am able to do
destination<- as.data.frame.matrix(xtabs(~order_id+dish_id, source))
But , i unable to get what i desired So can any1 help me to get data like in destination
Source:-
order_id primary_dish dish_id category_id
328507 38118 38114 1536
328523 38081 38068 1829
328523 38094 38068 1829
(Source data looks in above format)
Destination :-
order_id primary_dish 38114 38068 1536 1829
328507 38118 1 0 1 0
328523 38081 0 1 0 1
328523 38094 0 1 0 1