I have a vector of numeric elements, and a dataframe with two columns that define the start and end points of intervals. Each row in the dataframe is one interval. I want to
cut is possibly useful here.
cut
out <- cut(elements, t(intervals[c("start","end")])) levels(out)[c(FALSE,TRUE)] <- NA intervals$phase[out] #[1] "a" "a" "a" NA "b" "b" "c"