I have a DF with a 'size' column with numbers. I would like to replace these numbers with small, medium or large based on the ranges small = 1:10 medium = 11:49 large = 50:200.
I have tried using
table$Size <- factor(table$Size,
levels = c(1:10),c(11:49),c(50:200),
labels = c("small"),c("medium"),c("large"))
But I understand why this doesnt work. I have also tried using str_replace all but this also produce an error.
Is there a way to replace numbers within these ranges with the respective label?