I have a data frame similar to the following example:
> df <- data.frame(imp = c("Johny", "Johny", "Lisa", "Max"), item = c(5025, 1101, 2057, 1619))
> df
imp item
[1,] "Johny" "5025"
[2,] "Johny" "1101"
[3,] "Lisa" "2057"
[4,] "Max" "1619"
I would like to have an unique row for each user
. The final result should be something like this:
> df
imp item1 item2
[1,] "Johny" "5025" "1101"
[2,] "Lisa" "2057" NA
[3,] "Max" "1619" NA