问题 basically I have a single column data set of 53 values. what I am trying to achieve is binning them into sets based on a 400 point difference, ranging from ~500 to 4500. you can just be vague if needed and state a function for doing so, I can work out the rest 回答1: A dplyr option library(dplyr) df_test <- data.frame(x = runif(1000, 400, 5000), y = rep("A", 1000)) df_test <- df_test %>% mutate(bins = case_when(between(x, 400, 800) ~ "Set 1", between(x, 801, 1600) ~ "Set 2", between(x, 1601,