Thanks Duncan... More appended at the bottom...
On 7/12/10 5:38 PM, "Duncan Murdoch" wrote:
> On 12/07/2010 5:25 PM, Bryan Hanson wrote:
>> Hello Wise Ones...
>>
>> I need a clever way around a problem with findInterval. Consider:
>>
>> vec1 <- 1:10
>> vec2 <- seq(1, 10, by = 0.1)
>>
>> x1
How about this:
these = which(vec2 < x1[1] | vec2 > x1[2])
vec2[these]
# Or using logical indexation directly:
vec2[vec2 < x1[1] | vec2 > x1[2]]
>>>
From: Bryan Hanson
To:R Help
Date: 13/Jul/2010 9:28a
Subject: [R] findInterval and data resolution
Hello Wise Ones...
On 12/07/2010 5:25 PM, Bryan Hanson wrote:
Hello Wise Ones...
I need a clever way around a problem with findInterval. Consider:
vec1 <- 1:10
vec2 <- seq(1, 10, by = 0.1)
x1 <- c(2:3)
a1 <- findInterval(x1, vec1); a1 # example 1
a2 <- findInterval(x1, vec2); a2 # example 2
In the problem I'
Hello Wise Ones...
I need a clever way around a problem with findInterval. Consider:
vec1 <- 1:10
vec2 <- seq(1, 10, by = 0.1)
x1 <- c(2:3)
a1 <- findInterval(x1, vec1); a1 # example 1
a2 <- findInterval(x1, vec2); a2 # example 2
In the problem I'm working on, vec* may be either integer or n
4 matches
Mail list logo