salesList %>% group_by(updated_actual_related_customer, sku) %>% mutate( final_offer = foo(x, data ))
I would like to pass the chunk of data that corresponds to the grouped 'customer-sku' part to my 'foo' function. How can I do that? Is it possible to use lead( ... ... ... ) with multiple variables and as 'n' argument 'count()'?
Suggestions are greatly appreciated.
Thanks in advance!