Divide groups in other groups by date intervals
I’m dealing with dates and I wanted to group some rows together but I can’t find how.
In my data, one row is an individual in a time interval and in a place. Something like that :
Counting number of days from event, till another event in R
data.frame(
scrape_date = as.Date(c(“2023-01-01”, “2023-01-02”, “2023-01-03”, “2023-01-04”, “2023-01-05”, “2023-01-06”, “2023-01-07”, “2023-01-08”)),
own_product_id = c(“00617″,”00617″,”00617″,”00617″,”00617″,”00617″,”00617″,”00617”),
own_price = c(70, 70, 70, 70, 70,70,70,71),
comp_price = c(70, 71, 71, 71, 71,71,71,71)
)