Hi, Ambiflextrous. I don't know if you've solved your problem, but as the book "R For Data Science" says, we can use our tools, so I will try to tell you what AI answers to your problem:
This code first filters rows where has_sale == TRUE, then groups the data by year and month. Next, it calculates the next month and year. After that, it performs a left join with the original data, but only with the rows where has_sale == FALSE, using the previously calculated next months and years. It then regroups the data by year, month, and price, and summarizes the next month sales as a list. Finally, it adjusts rows with null future sales and removes the grouping.Preformatted text