Actually, I have solved this question, but I have problems because the solution is in two steps, which are really separated between each other (the first step is inside a function and the second step is inside another; this would imply me to make H as an output).
First, the replicable example:
RN = rnorm(n=1000,10,20)
H = cut2(RN,g=4,onlycuts=FALSE) # Step 1: The intervals are generated
H2= cut2(RN,g=4,onlycuts=TRUE) # Step 1: (This would be useful if Step 1 and 2 were not separated)
new_number = 10.53 # Step 2: New number
interval_new_number = cut2(new_number,cuts=H) # Step 2: Interval for new number
I would like to know a solution which can be done as:
new_number %in% H
Give me your opinion.