Select observations from a subset to create a new subset based on a large dataframe in R
===

I have a dataset (Purchase.df) that contains many columns and rows. The important variable names for this question are "Customer", "OrderDate", "DateRank" (which ranks the dates so I can find the smallest date) and "BrandName." I've created a subset of this large dataset (subset.df) which finds the first OrderDate for each customer, and tells me which brand they purchased. I used the following code to do this:

    subset1<-split(Purchase.df,Purchase.df$Customer)
    subset2<-lapply(split(Purchase.df,Purchase.df$CustomerShipTo), function(chunk) chunk[which(chunk$DateRank==min(chunk$DateRank)),])
    subset.df<-do.call(rbind, as.list(subset2))

Now, I want to figure out which customers ordered Brand X on their first OrderDate, and create a new dataset (BigSubset.df) that contains all of the OrderDates for the customers that purchased Brand X on their first order date.

I can't seem to get R to reference the smaller dataset when I attempt to create BigSubset.df from Purchase.df because the number of rows are not equal. I've searched on Google and haven't seen any answers, so I'm not even sure if this is possible in R. Let me know what you think.