Get recode assigments for even intervals of discrete numeric values compatible with car::recode.
generate_recodes(from, to, width = 5)
A numeric value for the beginning and the end of the interval.
numeric value
The width of the interval, e.g. 5 (default) for intervals 0-5.
A character vector of recode assignments compatible with car::recode.
character
# NOT RUN { x <- round(runif(100, 0, 100), 0) recodes <- generate_recodes(0, 100, 10) library(car) recode(x, recodes = recodes) # }
Run the code above in your browser using DataLab