How to get multiple variables from lead()

Hello everyone,

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!

Charles

Hi Charles!
It's quite difficult to understand the problem and reach a solution without a reprex. Could you please turn it into a reproducible example?

4 Likes