I have this data:
12.1 12.5 12.6 12.7 12.8 13.0 13.2 13.2 13.2 13.3 13.3 13.3
13.4 13.4 13.5 13.5 13.7 13.7 13.7 13.8 13.9 14.1 14.1 14.2
14.3 14.3 14.3 14.4 14.4 14.5 14.6 14.6 14.6 14.8 14.8 14.9
14.9 14.9 15.2 15.2 15.3 15.3 15.5 15.6 15.6 15.7 15.8 15.9
16.1 16.1 16.3 16.4 16.4 16.5 16.7 16.9 17.0
and I'd like to put it into these bins:
12.1 12.5 12.6 12.7 12.8 13.0 13.2 13.3 13.4 13.5 13.7 13.8
13.9 14.1 14.2 14.3 14.4 14.5 14.6 14.8 14.9 15.2 15.3 15.5
15.6 15.7 15.8 15.9 16.1 16.3 16.4 16.5 16.7 16.9 17.0
So for example, the 13.2 and 13.3 bins would have 3 items, etc.
I should mention that the dataset has other columns I want to follow this numeric data into the bins.
I'm new to R and trying to figure out binning.
Here is code to setup my data, and the unique values:
test <- function() {
data <- c(12.1,12.5,12.6,12.7,12.8,13.0,13.2,13.2,13.2,13.3,13.3,13.3,
13.4,13.4,13.5,13.5,13.7,13.7,13.7,13.8,13.9,14.1,14.1,14.2,
14.3,14.3,14.3,14.4,14.4,14.5,14.6,14.6,14.6,14.8,14.8,14.9,
14.9,14.9,15.2,15.2,15.3,15.3,15.5,15.6,15.6,15.7,15.8,15.9,
16.1,16.1,16.3,16.4,16.4,16.5,16.7,16.9,17.0)
unique_data = unique(data)
print(unique_data)
}