Subset values with matching criteria in r
问题 I had a similar question here but this one is slightly different. I would like to return values with matching conditions in another column based on a cut score criterion. If the cut scores are not available in the variable, I would like to grab closest larger value for the first and second cut, and grab the closest smallest value for the third cut. Here is a snapshot of dataset: ids <- c(1,2,3,4,5,6,7,8,9,10) scores.a <- c(512,531,541,555,562,565,570,572,573,588) scores.b <- c(12,13,14,15,16