I have a data.frame with 32,000 entries. Here's a sample:
# df1
MINEVENT MAXEVENT EVENTRANGE NUMEVENT cplt_flag
2680001 2680051 2680001-2680051 51 0
2680001 2680051 2680001-2680051 51 0
2680001 2680051 2680001-2680051 51 0
2680001 2680051 2680001-2680051 51 0
2680001 2680051 2680001-2680051 51 0
2680001 2680051 2680001-2680051 51 0
and another with a list of 157 values. Here's a sample:
# df2
source_id
211535
211535
211535
211536
211536
211536
I want to read from the source_id and test whether the value falls between MINEVENT and MAXEVENT. If TRUE then I want to enter a value 1 into cplt_flag, else 0.
I have a code using if-else statements but it runs super slow for the 32,000 entries. Also, I have been trying to use functions and apply functions but cannot get this to work.
I'm looking for an efficient way to get this done.