I have a dataset in a data.table format that looks as such:
data.table
ID time.s time.e 1 1 2 2 1 4 3 2 3
Here's a dplyr option in case anybody stumbles on this question:
dplyr
library(dplyr) value = 1 df %>% mutate(ok = value >= time.s & value <= time.e) ID time.s time.e ok 1 1 1 2 TRUE 2 2 1 4 TRUE 3 3 2 3 FALSE 4 4 2 4 FALSE