0

On the x-axis I have dates and for each date I have a qualitative variable (colour). I would like to create on R a new df with the date on which my variable changes (e.g. the date from which I turn orange).

Date Color
2003-08-21 Green
2003-09-01 Green
2003-09-11 Green
2003-09-21 Green
2003-10-01 Orange
2003-10-11 Orange
2003-10-21 Orange
2003-11-01 Black
2003-11-11 Black

I haven't found any solutions on the forum

Which I expect :

Date Switch
2003-10-01 Green to orange
2003-11-01 Orange to black

I haven't tried anything because I haven't found anything that would allow me to do that

0

Browse other questions tagged or ask your own question.