## Not run:
# library(car)
#
# # the standard way if we want to recode [1,2) to the value 3
# recode(c(1, 1.999, 2, 2.001), "1:2-1e-4=3")
#
# # the same using interval notation
# intervals("[1,2)=3")
# recode(c(1, 1.999, 2, 2.001), intervals("[1,2)=3"))
#
# # another example: the car way
# e <- 10^-8
# recode(1:9/3.01, "lo:1-e=0; 1:2-e=1; 2:3-e=2")
# # using intervals
# recode(1:9/3.01, intervals("[lo,1)=0; [1,2)=1; [2,3)=2"))
# ## End(Not run)
Run the code above in your browser using DataLab