I want to do just that: Use dates from one data frame and filter data in another data frame - R
other than combining, because I'm afraid that after I join my data, the result will be too large to fit the memory before the filter.
Here is an example of data:
tmp_df <- data.frame(a = 1:10)
I want to perform an operation that looks like this:
lower_bound <- c(2, 4) upper_bound <- c(2, 5) tmp_df %>% filter(a >= lower_bound & a <= upper_bound)
and my desired result:
> tmp_df[(tmp_df$a <= 2 & tmp_df$a >= 2) | (tmp_df$a <= 5 & tmp_df$a >= 4), , drop = F]
My problem with memory requirements (regarding a connection-related solution) is that tmp_df has a lot more lines, and the lower_bound and upper_bound have a lot more records. A dplyr solution, or a solution that may be part of a pipe, is preferred.
source share