Check if date is whtitin data range for each row

i have an sf which contains several columns and a lot of row, like this one but with more rows:
Cattura

I would like to check if acq_date is between start_date and end_date (row by row ) and therefore have an output where only the lines that are between start and stop date are present, adding the fit column as in the image above

I can't check if acq_date is between start and end date for each single row, but i can do it for the whole column and the result is incorrect. Having a column with true or false later allows me to select only the true ones and delete the rows with false.

I hope I have expressed the problem clearly, I apologize but I am new with r.

Thanks to those who want to help me

Alternatively this works without the need for rowwise():

library(dplyr)
sample_data %>% mutate(is_between = (acq_date >= start_date & acq_date <= end_date))

wow! you are fantastic ... I managed to solve my problem that had been blocking me for 2 days. Thanks and I hope to be able to reciprocate your precious contribution

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.