Filter by ranges supplied by two vectors, without a join operation












7














I wish to do exactly this: Take dates from one dataframe and filter data in another dataframe - R



except without joining, as I am afraid that after I join my data the result will be too big to fit in memory, prior to the filter.



Here is sample data:



tmp_df <- data.frame(a = 1:10)


I wish to do 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) # does not work as <= is vectorised inappropriately


and my desired result is:



> tmp_df[(tmp_df$a <= 2 & tmp_df$a >= 2) | (tmp_df$a <= 5 & tmp_df$a >= 4), , drop = F] 
# one way to get indices to subset data frame, impractical for a long range vector
a
2 2
4 4
5 5


My problem with memory requirements (with respect to the join solution linked) is when tmp_df has many more rows and the lower_bound and upper_bound vectors have many more entries. A dplyr solution, or a solution that can be part of pipe is preferred.










share|improve this question




















  • 1




    Related post: stackoverflow.com/questions/36454565/…
    – mt1022
    Jun 19 '17 at 4:02










  • You could simply do tmp_df %>% filter(a == 2 | between(a, 4, 5)) or combine a few between statements, or you could simply use the same syntax as in base R such as tmp_df %>% filter(a == 2 | (a <= 5 & a >= 4)) or even tmp_df %>% filter(a %in% c(2, 4:5)). I really fail to understand what's the question's about even.
    – David Arenburg
    Jun 19 '17 at 8:06












  • The question is about how you do this when the vectors supplying the ranges have lots of elements, say 100 each.
    – Alex
    Jun 19 '17 at 8:08










  • As always, you are answering comments without using @ (so I won't see your further comments), but I suggest you clarify that in your question and show a real use case rather just a small example which could be easily solved in many simple ways.
    – David Arenburg
    Jun 19 '17 at 8:11










  • I have reworded the question which hopefully addresses your comments regarding the clarity. I do not believe in real use cases when simple examples are easier to read and understand.
    – Alex
    Jun 19 '17 at 8:26
















7














I wish to do exactly this: Take dates from one dataframe and filter data in another dataframe - R



except without joining, as I am afraid that after I join my data the result will be too big to fit in memory, prior to the filter.



Here is sample data:



tmp_df <- data.frame(a = 1:10)


I wish to do 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) # does not work as <= is vectorised inappropriately


and my desired result is:



> tmp_df[(tmp_df$a <= 2 & tmp_df$a >= 2) | (tmp_df$a <= 5 & tmp_df$a >= 4), , drop = F] 
# one way to get indices to subset data frame, impractical for a long range vector
a
2 2
4 4
5 5


My problem with memory requirements (with respect to the join solution linked) is when tmp_df has many more rows and the lower_bound and upper_bound vectors have many more entries. A dplyr solution, or a solution that can be part of pipe is preferred.










share|improve this question




















  • 1




    Related post: stackoverflow.com/questions/36454565/…
    – mt1022
    Jun 19 '17 at 4:02










  • You could simply do tmp_df %>% filter(a == 2 | between(a, 4, 5)) or combine a few between statements, or you could simply use the same syntax as in base R such as tmp_df %>% filter(a == 2 | (a <= 5 & a >= 4)) or even tmp_df %>% filter(a %in% c(2, 4:5)). I really fail to understand what's the question's about even.
    – David Arenburg
    Jun 19 '17 at 8:06












  • The question is about how you do this when the vectors supplying the ranges have lots of elements, say 100 each.
    – Alex
    Jun 19 '17 at 8:08










  • As always, you are answering comments without using @ (so I won't see your further comments), but I suggest you clarify that in your question and show a real use case rather just a small example which could be easily solved in many simple ways.
    – David Arenburg
    Jun 19 '17 at 8:11










  • I have reworded the question which hopefully addresses your comments regarding the clarity. I do not believe in real use cases when simple examples are easier to read and understand.
    – Alex
    Jun 19 '17 at 8:26














7












7








7


1





I wish to do exactly this: Take dates from one dataframe and filter data in another dataframe - R



except without joining, as I am afraid that after I join my data the result will be too big to fit in memory, prior to the filter.



Here is sample data:



tmp_df <- data.frame(a = 1:10)


I wish to do 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) # does not work as <= is vectorised inappropriately


and my desired result is:



> tmp_df[(tmp_df$a <= 2 & tmp_df$a >= 2) | (tmp_df$a <= 5 & tmp_df$a >= 4), , drop = F] 
# one way to get indices to subset data frame, impractical for a long range vector
a
2 2
4 4
5 5


My problem with memory requirements (with respect to the join solution linked) is when tmp_df has many more rows and the lower_bound and upper_bound vectors have many more entries. A dplyr solution, or a solution that can be part of pipe is preferred.










share|improve this question















I wish to do exactly this: Take dates from one dataframe and filter data in another dataframe - R



except without joining, as I am afraid that after I join my data the result will be too big to fit in memory, prior to the filter.



Here is sample data:



tmp_df <- data.frame(a = 1:10)


I wish to do 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) # does not work as <= is vectorised inappropriately


and my desired result is:



> tmp_df[(tmp_df$a <= 2 & tmp_df$a >= 2) | (tmp_df$a <= 5 & tmp_df$a >= 4), , drop = F] 
# one way to get indices to subset data frame, impractical for a long range vector
a
2 2
4 4
5 5


My problem with memory requirements (with respect to the join solution linked) is when tmp_df has many more rows and the lower_bound and upper_bound vectors have many more entries. A dplyr solution, or a solution that can be part of pipe is preferred.







r data.table dplyr subset






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 at 18:13









Henrik

40.7k992107




40.7k992107










asked Jun 19 '17 at 3:06









Alex

6,87554180




6,87554180








  • 1




    Related post: stackoverflow.com/questions/36454565/…
    – mt1022
    Jun 19 '17 at 4:02










  • You could simply do tmp_df %>% filter(a == 2 | between(a, 4, 5)) or combine a few between statements, or you could simply use the same syntax as in base R such as tmp_df %>% filter(a == 2 | (a <= 5 & a >= 4)) or even tmp_df %>% filter(a %in% c(2, 4:5)). I really fail to understand what's the question's about even.
    – David Arenburg
    Jun 19 '17 at 8:06












  • The question is about how you do this when the vectors supplying the ranges have lots of elements, say 100 each.
    – Alex
    Jun 19 '17 at 8:08










  • As always, you are answering comments without using @ (so I won't see your further comments), but I suggest you clarify that in your question and show a real use case rather just a small example which could be easily solved in many simple ways.
    – David Arenburg
    Jun 19 '17 at 8:11










  • I have reworded the question which hopefully addresses your comments regarding the clarity. I do not believe in real use cases when simple examples are easier to read and understand.
    – Alex
    Jun 19 '17 at 8:26














  • 1




    Related post: stackoverflow.com/questions/36454565/…
    – mt1022
    Jun 19 '17 at 4:02










  • You could simply do tmp_df %>% filter(a == 2 | between(a, 4, 5)) or combine a few between statements, or you could simply use the same syntax as in base R such as tmp_df %>% filter(a == 2 | (a <= 5 & a >= 4)) or even tmp_df %>% filter(a %in% c(2, 4:5)). I really fail to understand what's the question's about even.
    – David Arenburg
    Jun 19 '17 at 8:06












  • The question is about how you do this when the vectors supplying the ranges have lots of elements, say 100 each.
    – Alex
    Jun 19 '17 at 8:08










  • As always, you are answering comments without using @ (so I won't see your further comments), but I suggest you clarify that in your question and show a real use case rather just a small example which could be easily solved in many simple ways.
    – David Arenburg
    Jun 19 '17 at 8:11










  • I have reworded the question which hopefully addresses your comments regarding the clarity. I do not believe in real use cases when simple examples are easier to read and understand.
    – Alex
    Jun 19 '17 at 8:26








1




1




Related post: stackoverflow.com/questions/36454565/…
– mt1022
Jun 19 '17 at 4:02




Related post: stackoverflow.com/questions/36454565/…
– mt1022
Jun 19 '17 at 4:02












You could simply do tmp_df %>% filter(a == 2 | between(a, 4, 5)) or combine a few between statements, or you could simply use the same syntax as in base R such as tmp_df %>% filter(a == 2 | (a <= 5 & a >= 4)) or even tmp_df %>% filter(a %in% c(2, 4:5)). I really fail to understand what's the question's about even.
– David Arenburg
Jun 19 '17 at 8:06






You could simply do tmp_df %>% filter(a == 2 | between(a, 4, 5)) or combine a few between statements, or you could simply use the same syntax as in base R such as tmp_df %>% filter(a == 2 | (a <= 5 & a >= 4)) or even tmp_df %>% filter(a %in% c(2, 4:5)). I really fail to understand what's the question's about even.
– David Arenburg
Jun 19 '17 at 8:06














The question is about how you do this when the vectors supplying the ranges have lots of elements, say 100 each.
– Alex
Jun 19 '17 at 8:08




The question is about how you do this when the vectors supplying the ranges have lots of elements, say 100 each.
– Alex
Jun 19 '17 at 8:08












As always, you are answering comments without using @ (so I won't see your further comments), but I suggest you clarify that in your question and show a real use case rather just a small example which could be easily solved in many simple ways.
– David Arenburg
Jun 19 '17 at 8:11




As always, you are answering comments without using @ (so I won't see your further comments), but I suggest you clarify that in your question and show a real use case rather just a small example which could be easily solved in many simple ways.
– David Arenburg
Jun 19 '17 at 8:11












I have reworded the question which hopefully addresses your comments regarding the clarity. I do not believe in real use cases when simple examples are easier to read and understand.
– Alex
Jun 19 '17 at 8:26




I have reworded the question which hopefully addresses your comments regarding the clarity. I do not believe in real use cases when simple examples are easier to read and understand.
– Alex
Jun 19 '17 at 8:26












2 Answers
2






active

oldest

votes


















7














Maybe you could borrow the inrange function from data.table, which




checks whether each value in x is in between any of the
intervals provided in lower,upper.




Usage:



inrange(x, lower, upper, incbounds=TRUE)



library(dplyr); library(data.table)

tmp_df %>% filter(inrange(a, c(2,4), c(2,5)))
# a
#1 2
#2 4
#3 5





share|improve this answer



















  • 2




    Great solution ````
    – W-B
    Jun 19 '17 at 3:20






  • 2




    @Wen Thanks for the comment.
    – Psidom
    Jun 19 '17 at 3:20






  • 2




    Very neat, although I note that in the helpfile it says inrange makes use of this functionality and performs a range join. I have to check that this does not cause memory requirements to blow up.
    – Alex
    Jun 19 '17 at 3:53






  • 2




    @Alex, it was precisely implemented by having memory requirements in mind. I'd love to know how it turned up on your original dataset.
    – Arun
    Jun 19 '17 at 19:52






  • 2




    @arun I am doing a 4 million row by 30 million row range join (since inrange uses non equi-joins I decided to rewrite everything using data.table syntax) and it is easily staying in memory.
    – Alex
    Nov 17 '17 at 9:55



















3














If you'd like to stick with dplyr it has similar functionality provided through the between function.



# ranges I want to check between
my_ranges <- list(c(2,2), c(4,5), c(6,7))

tmp_df <- data.frame(a=1:10)
tmp_df %>%
filter(apply(bind_rows(lapply(my_ranges,
FUN=function(x, a){
data.frame(t(between(a, x[1], x[2])))
}, a)
), 2, any))
a
1 2
2 4
3 5
4 6
5 7


Just be aware that the argument boundaries are included by default and that cannot be changed as with inrange






share|improve this answer























  • thanks for this, the problem is that I do not know how to, and is possible inefficient, to expand each vector into individual OR statements to give the required filtration
    – Alex
    Jun 19 '17 at 3:47












  • Have you considered keeping your ranges in a list, then using other functions that do the expansion for you? I've edited my answer to be more like this case, although, it makes the code less readable. I'm sure there's a cleaner way to write the code, it's just not coming to me right now.
    – Steven M. Mortimer
    Jun 19 '17 at 4:01













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44621700%2ffilter-by-ranges-supplied-by-two-vectors-without-a-join-operation%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









7














Maybe you could borrow the inrange function from data.table, which




checks whether each value in x is in between any of the
intervals provided in lower,upper.




Usage:



inrange(x, lower, upper, incbounds=TRUE)



library(dplyr); library(data.table)

tmp_df %>% filter(inrange(a, c(2,4), c(2,5)))
# a
#1 2
#2 4
#3 5





share|improve this answer



















  • 2




    Great solution ````
    – W-B
    Jun 19 '17 at 3:20






  • 2




    @Wen Thanks for the comment.
    – Psidom
    Jun 19 '17 at 3:20






  • 2




    Very neat, although I note that in the helpfile it says inrange makes use of this functionality and performs a range join. I have to check that this does not cause memory requirements to blow up.
    – Alex
    Jun 19 '17 at 3:53






  • 2




    @Alex, it was precisely implemented by having memory requirements in mind. I'd love to know how it turned up on your original dataset.
    – Arun
    Jun 19 '17 at 19:52






  • 2




    @arun I am doing a 4 million row by 30 million row range join (since inrange uses non equi-joins I decided to rewrite everything using data.table syntax) and it is easily staying in memory.
    – Alex
    Nov 17 '17 at 9:55
















7














Maybe you could borrow the inrange function from data.table, which




checks whether each value in x is in between any of the
intervals provided in lower,upper.




Usage:



inrange(x, lower, upper, incbounds=TRUE)



library(dplyr); library(data.table)

tmp_df %>% filter(inrange(a, c(2,4), c(2,5)))
# a
#1 2
#2 4
#3 5





share|improve this answer



















  • 2




    Great solution ````
    – W-B
    Jun 19 '17 at 3:20






  • 2




    @Wen Thanks for the comment.
    – Psidom
    Jun 19 '17 at 3:20






  • 2




    Very neat, although I note that in the helpfile it says inrange makes use of this functionality and performs a range join. I have to check that this does not cause memory requirements to blow up.
    – Alex
    Jun 19 '17 at 3:53






  • 2




    @Alex, it was precisely implemented by having memory requirements in mind. I'd love to know how it turned up on your original dataset.
    – Arun
    Jun 19 '17 at 19:52






  • 2




    @arun I am doing a 4 million row by 30 million row range join (since inrange uses non equi-joins I decided to rewrite everything using data.table syntax) and it is easily staying in memory.
    – Alex
    Nov 17 '17 at 9:55














7












7








7






Maybe you could borrow the inrange function from data.table, which




checks whether each value in x is in between any of the
intervals provided in lower,upper.




Usage:



inrange(x, lower, upper, incbounds=TRUE)



library(dplyr); library(data.table)

tmp_df %>% filter(inrange(a, c(2,4), c(2,5)))
# a
#1 2
#2 4
#3 5





share|improve this answer














Maybe you could borrow the inrange function from data.table, which




checks whether each value in x is in between any of the
intervals provided in lower,upper.




Usage:



inrange(x, lower, upper, incbounds=TRUE)



library(dplyr); library(data.table)

tmp_df %>% filter(inrange(a, c(2,4), c(2,5)))
# a
#1 2
#2 4
#3 5






share|improve this answer














share|improve this answer



share|improve this answer








edited Jun 19 '17 at 3:22

























answered Jun 19 '17 at 3:19









Psidom

122k1281125




122k1281125








  • 2




    Great solution ````
    – W-B
    Jun 19 '17 at 3:20






  • 2




    @Wen Thanks for the comment.
    – Psidom
    Jun 19 '17 at 3:20






  • 2




    Very neat, although I note that in the helpfile it says inrange makes use of this functionality and performs a range join. I have to check that this does not cause memory requirements to blow up.
    – Alex
    Jun 19 '17 at 3:53






  • 2




    @Alex, it was precisely implemented by having memory requirements in mind. I'd love to know how it turned up on your original dataset.
    – Arun
    Jun 19 '17 at 19:52






  • 2




    @arun I am doing a 4 million row by 30 million row range join (since inrange uses non equi-joins I decided to rewrite everything using data.table syntax) and it is easily staying in memory.
    – Alex
    Nov 17 '17 at 9:55














  • 2




    Great solution ````
    – W-B
    Jun 19 '17 at 3:20






  • 2




    @Wen Thanks for the comment.
    – Psidom
    Jun 19 '17 at 3:20






  • 2




    Very neat, although I note that in the helpfile it says inrange makes use of this functionality and performs a range join. I have to check that this does not cause memory requirements to blow up.
    – Alex
    Jun 19 '17 at 3:53






  • 2




    @Alex, it was precisely implemented by having memory requirements in mind. I'd love to know how it turned up on your original dataset.
    – Arun
    Jun 19 '17 at 19:52






  • 2




    @arun I am doing a 4 million row by 30 million row range join (since inrange uses non equi-joins I decided to rewrite everything using data.table syntax) and it is easily staying in memory.
    – Alex
    Nov 17 '17 at 9:55








2




2




Great solution ````
– W-B
Jun 19 '17 at 3:20




Great solution ````
– W-B
Jun 19 '17 at 3:20




2




2




@Wen Thanks for the comment.
– Psidom
Jun 19 '17 at 3:20




@Wen Thanks for the comment.
– Psidom
Jun 19 '17 at 3:20




2




2




Very neat, although I note that in the helpfile it says inrange makes use of this functionality and performs a range join. I have to check that this does not cause memory requirements to blow up.
– Alex
Jun 19 '17 at 3:53




Very neat, although I note that in the helpfile it says inrange makes use of this functionality and performs a range join. I have to check that this does not cause memory requirements to blow up.
– Alex
Jun 19 '17 at 3:53




2




2




@Alex, it was precisely implemented by having memory requirements in mind. I'd love to know how it turned up on your original dataset.
– Arun
Jun 19 '17 at 19:52




@Alex, it was precisely implemented by having memory requirements in mind. I'd love to know how it turned up on your original dataset.
– Arun
Jun 19 '17 at 19:52




2




2




@arun I am doing a 4 million row by 30 million row range join (since inrange uses non equi-joins I decided to rewrite everything using data.table syntax) and it is easily staying in memory.
– Alex
Nov 17 '17 at 9:55




@arun I am doing a 4 million row by 30 million row range join (since inrange uses non equi-joins I decided to rewrite everything using data.table syntax) and it is easily staying in memory.
– Alex
Nov 17 '17 at 9:55













3














If you'd like to stick with dplyr it has similar functionality provided through the between function.



# ranges I want to check between
my_ranges <- list(c(2,2), c(4,5), c(6,7))

tmp_df <- data.frame(a=1:10)
tmp_df %>%
filter(apply(bind_rows(lapply(my_ranges,
FUN=function(x, a){
data.frame(t(between(a, x[1], x[2])))
}, a)
), 2, any))
a
1 2
2 4
3 5
4 6
5 7


Just be aware that the argument boundaries are included by default and that cannot be changed as with inrange






share|improve this answer























  • thanks for this, the problem is that I do not know how to, and is possible inefficient, to expand each vector into individual OR statements to give the required filtration
    – Alex
    Jun 19 '17 at 3:47












  • Have you considered keeping your ranges in a list, then using other functions that do the expansion for you? I've edited my answer to be more like this case, although, it makes the code less readable. I'm sure there's a cleaner way to write the code, it's just not coming to me right now.
    – Steven M. Mortimer
    Jun 19 '17 at 4:01


















3














If you'd like to stick with dplyr it has similar functionality provided through the between function.



# ranges I want to check between
my_ranges <- list(c(2,2), c(4,5), c(6,7))

tmp_df <- data.frame(a=1:10)
tmp_df %>%
filter(apply(bind_rows(lapply(my_ranges,
FUN=function(x, a){
data.frame(t(between(a, x[1], x[2])))
}, a)
), 2, any))
a
1 2
2 4
3 5
4 6
5 7


Just be aware that the argument boundaries are included by default and that cannot be changed as with inrange






share|improve this answer























  • thanks for this, the problem is that I do not know how to, and is possible inefficient, to expand each vector into individual OR statements to give the required filtration
    – Alex
    Jun 19 '17 at 3:47












  • Have you considered keeping your ranges in a list, then using other functions that do the expansion for you? I've edited my answer to be more like this case, although, it makes the code less readable. I'm sure there's a cleaner way to write the code, it's just not coming to me right now.
    – Steven M. Mortimer
    Jun 19 '17 at 4:01
















3












3








3






If you'd like to stick with dplyr it has similar functionality provided through the between function.



# ranges I want to check between
my_ranges <- list(c(2,2), c(4,5), c(6,7))

tmp_df <- data.frame(a=1:10)
tmp_df %>%
filter(apply(bind_rows(lapply(my_ranges,
FUN=function(x, a){
data.frame(t(between(a, x[1], x[2])))
}, a)
), 2, any))
a
1 2
2 4
3 5
4 6
5 7


Just be aware that the argument boundaries are included by default and that cannot be changed as with inrange






share|improve this answer














If you'd like to stick with dplyr it has similar functionality provided through the between function.



# ranges I want to check between
my_ranges <- list(c(2,2), c(4,5), c(6,7))

tmp_df <- data.frame(a=1:10)
tmp_df %>%
filter(apply(bind_rows(lapply(my_ranges,
FUN=function(x, a){
data.frame(t(between(a, x[1], x[2])))
}, a)
), 2, any))
a
1 2
2 4
3 5
4 6
5 7


Just be aware that the argument boundaries are included by default and that cannot be changed as with inrange







share|improve this answer














share|improve this answer



share|improve this answer








edited Jun 19 '17 at 4:07

























answered Jun 19 '17 at 3:30









Steven M. Mortimer

844618




844618












  • thanks for this, the problem is that I do not know how to, and is possible inefficient, to expand each vector into individual OR statements to give the required filtration
    – Alex
    Jun 19 '17 at 3:47












  • Have you considered keeping your ranges in a list, then using other functions that do the expansion for you? I've edited my answer to be more like this case, although, it makes the code less readable. I'm sure there's a cleaner way to write the code, it's just not coming to me right now.
    – Steven M. Mortimer
    Jun 19 '17 at 4:01




















  • thanks for this, the problem is that I do not know how to, and is possible inefficient, to expand each vector into individual OR statements to give the required filtration
    – Alex
    Jun 19 '17 at 3:47












  • Have you considered keeping your ranges in a list, then using other functions that do the expansion for you? I've edited my answer to be more like this case, although, it makes the code less readable. I'm sure there's a cleaner way to write the code, it's just not coming to me right now.
    – Steven M. Mortimer
    Jun 19 '17 at 4:01


















thanks for this, the problem is that I do not know how to, and is possible inefficient, to expand each vector into individual OR statements to give the required filtration
– Alex
Jun 19 '17 at 3:47






thanks for this, the problem is that I do not know how to, and is possible inefficient, to expand each vector into individual OR statements to give the required filtration
– Alex
Jun 19 '17 at 3:47














Have you considered keeping your ranges in a list, then using other functions that do the expansion for you? I've edited my answer to be more like this case, although, it makes the code less readable. I'm sure there's a cleaner way to write the code, it's just not coming to me right now.
– Steven M. Mortimer
Jun 19 '17 at 4:01






Have you considered keeping your ranges in a list, then using other functions that do the expansion for you? I've edited my answer to be more like this case, although, it makes the code less readable. I'm sure there's a cleaner way to write the code, it's just not coming to me right now.
– Steven M. Mortimer
Jun 19 '17 at 4:01




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44621700%2ffilter-by-ranges-supplied-by-two-vectors-without-a-join-operation%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

What visual should I use to simply compare current year value vs last year in Power BI desktop

Alexandru Averescu

Trompette piccolo