I would to identify the index (position) of values in a vector with an occcurence condition.
I have a dataframe with three columns : "Image_series_names", "Image_number" and "Convergence_type" with 2280 values.
Here the description of my dataframe :
The "Image_series_names" column is a character column with a different value at each 30 lines. So there are 2280/30 = 76 different strings. The "Image_Number" column is an index with a loop from 1 to 30 number (there are 30 images for each "Image_series_names" value). the "Convergence_type" column has two values : "convergence" and "no_convergence".
My purpose is to identify for each "Image_series_names" value, the first "image_number" index that match with "convergence" value in "Convergence_Type" column only if the 4 following values are also with the same value "convergence".
I hope I describe correctly my problem as I don't know how to put only my dataframe.
Thank you for your kind support and your reading. Best regards.
I don't know what to google to find my solution. If it possible I prefer to have a tidyverse solution as it's more friendly for me to understand