I'm looking for an R function that simply recodes a quantitative variable into a number of classes according to specified break-points. Obviously I can do this using nested ifelse() commands, but I want to write it into a function where I can't pre-specify the number of classes. Is there an obvious way to do this?
An example to clarify: how to convert c(0,10,5,1,9,6) to c(1,3,2,1,3,2) by specifying "breaks"=c(2.5,7.5) - or something like that.
Thanks, Richard Gunton. INRA-Dijon, France ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.