I have a dataset of online purchases from one site. Each row represents different item packed, but it does not necessarly represent a seperate order. I would like to know how many different items were packed in one parcel. A variable order_code reperesents a specific order.
I am wondering how can I count the rows that contain the same order_code --> which would directly correspond to how much of the items I have per order.
data$result <- group_by(data,order_code)
this does not return the desired outcome...
the data and the final outut should looke like the table below:
order_code  date         desired output
302492016   2016-07-01  
302492016   2016-07-01    2
302502016   2016-07-01  
302502016   2016-07-01    2
302512016   2016-07-01  
302512016   2016-07-01    2
302522016   2016-07-01    1
302532016   2016-07-01  
302532016   2016-07-01    2
 
    