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)
)
if i wanted to count the number of days it takes from when comp_price changes, till own_price is the same? how would i do it? its been doing my head in sorry
expecting an output like
product_id time_taken_to_match
00617 6 days
James Madds is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.