Create new column so that numeric values get turned into charaters

41 views Asked by At

Am trying to categorize integer values so that if between 7499 & 5500, returns 'Moderate-Hard', etc.

Tried mutating and putting ifelse. Total distance is numeric (varies between 12,000 & 0)

MSoc%>%
  mutate(`Total Distance`, 'Dist' = ifelse(`Total Distance` %in% 3500:5499, "Moderate",
                                               ifelse(`Total Distance` %in% 5500:7499, "Moderate-Hard",
                                               ifelse(`Total Distance` %in% 7500:1500, "Hard","Easy"))))

When I return just get those numbers back and not the titles (-Inf,3.5e+03).

Want the column to be 'Dist' and have Moderate, Easy, Moderate, etc based off what "Total Distance" column provides.

0

There are 0 answers