I have the following dataframe (df)
start end
1 14379 32094
2 151884 174367
3 438422 449382
4 618123 621256
5 698271 714321
6 973394 975857
7 980508 982372
8 994539 994661
9 1055151 1058824
. . .
. . .
. . .
And a long boolean vector with boolean values (vec).
I would like to filter out all ranges in df that contain at least one TRUE value in the corresponding locations in vec.
In other words, a row with start=x end=y will be outputted iff !any(vec[x:y]).
Any ideas on how to accomplish that?
This is the same question as:
Adding a column to a dataframe in R
so it has the same answer… use apply, but with
anyinstead ofmean…