Splitting a continuous variable into equal sized groups
Or see cut_number from the ggplot2 package, e.g. das$wt_2 <- as.numeric(cut_number(das$wt,3)) Note that cut(…,3) divides the range of the original data into three ranges of equal lengths; it doesn’t necessarily result in the same number of observations per group if the data are unevenly distributed (you can replicate what cut_number does by using quantile appropriately, … Read more