R summarise with condition I have customer data with the products they purchased and the purchase date. 


I want to extract a result that shows each customer and the first two fruits they purchased.

My actual set has 90000 rows with 9000 unique customers. I have tried groupby and summarise functions but I would like to be able to use summarise with condition like we use select with a where clause.
Thanks for your suggestions
Here is an example on the iris dataset

t(sapply(by(iris$Sepal.Length,iris$Species,function(x){x[1:2]}),as.numeric))


Where species is your customer, and Sepal.Length is your fruit.