I have a dataframe of purchasing events and ages of the individual.
Name Item Date
PersonA Apple 1/1/14
PersonA Banana 1/1/13
PersonA Pear 1/1/12
PersonB Orange 1/1/15
PersonC Kiwi 1/1/17
PersonC Grapes 1/1/12
PersonD Lemon 1/1/16
I want to rearrange it long to wide, but while keeping the dates for each of the purchasing events i.e
Name Item.x Date.x Item.y Date.y Item.z Item.z
PersonA Pear 1/1/12 Banana 1/1/13 Apple 1/1/14
PersonB Orange 1/1/15 NA NA NA NA
PersonC Grapes 1/1/12 Kiwi 1/1/17 NA NA
PersonD Lemon 1/1/16
I see lots of questions of generic long to wide, but not sure how to pull it into a wide format when two columns are involved(the item plus the date).