On possible way, if I understand the question correctly, is to use the
findInterval() function.
Otherwise, solutions depend on details you haven't included.
Here's an example from ?findInterval
x <- 2:18
v <- c(5, 10, 15) # create two bins [5,10) and [10,15)
cbind(x, findInterval(x, v))
T
You need to tell us what the objects are. Are they vectors of some
type of data? If so, what type, etc..
At least provide a subset of the data using 'dput' so we know what we
are looking at.
The 'if' statement will work fine is the objects are single valued;
you will need a different syntax
2 matches
Mail list logo