I make group based on the Mac. Again, I make group based on the UNIX_Time.x under the group of Mac. I want to delete a group based on the UNIX_Time.x. if TISD>=254 for one element of the group of UNIX_Time.x , I need to delete the group of UNIX_Time.x. I want to keep other rows of the sameMac. I tried the following code but it deletes the group based on the Mac. could you help me, please?
It looks like a misuse of filter_all and any_vars (though I'm not very familiar with them, they seem to be designed to operate on multiple columns at once).
You probably need the simpler dplyr::filter() and one of the all() or any() base functions. Try:
dplyr::filter(!any(TISD >= 254 | is.na(TISD)))
(Also, have a look at the default argument of lag() and at the na.rm arg of any() if you want to handle NAs differently).
@Aurele, thanks for helping! now, I need to delete rows from TISD>254 whether TISD is less than or equal or greater that 254 in the following rows upto the end of the group. I am adding an example where I group by Mac & UNIX_time.x. Each subgroup is based on the UNIX_time.x. Your help is highly appreciated.