Filtering the same year in different columns

Hi,

In order for us to help you, it's easier if you create a reprex which we can work with. A reprex consists of the minimal code and data needed to recreate the issue/question you're having. You can find instructions how to build and share one here:

Normally the filtering you wrote should work like so:

library(dplyr)

set.seed(2)
myData = data.frame(
  x = runif(10),
  HIV.Date = sample(c(2020,2021), 10, replace = T),
  X1st.Service = sample(c(2020,2021), 10, replace = T)
)

myData %>% filter(HIV.Date == 2021 | X1st.Service == 2021)
#>           x HIV.Date X1st.Service
#> 1 0.5733263     2021         2020
#> 2 0.1680519     2020         2021
#> 3 0.1291590     2021         2021
#> 4 0.8334488     2021         2020
#> 5 0.4680185     2021         2021
#> 6 0.5499837     2021         2021

Created on 2021-07-13 by the reprex package (v2.0.0)

Post a reprex and we can take it from there
PJ