I read this question here:
Group numeric values using intervals
However, I would like to output a numerical (not a coefficient), in particular a numerical value of the lower and / or upper boundaries (in separate columns)
In essence, this is correct, except that "df $ start" and "df $ end" are specified as factors:
df$start <- cut(df$x,
breaks = c(0,25,75,125,175,225,299),
labels = c(0,25,75,125,175,225),
right = TRUE)
df$end <- cut(df$x,
breaks = c(0,25,75,125,175,225,299),
labels = c(25,75,125,175,225,299),
right = TRUE)
Using 'as.numeric ()' returns the level of the factor (i.e., values 1-6), not the original numbers.
Thanks!