Hi,
I have a column in the data with about 375 different values. I want to replace those values into about 10 unique values such as (Urine, Blood, Wound, Skin, Respiratory....)
For example, change: 'Blood', 'Bld', 'Blood sample', 'Bld specimen' .....to "Blood".
'Ur', 'Urine sample', 'Urine', 'Urinary specimen', 'Urine Catheter' to ........"Urine"
'Wnd', 'Wound swab', 'Wound', 'Scar wound', 'wound' to ......"Wound"
All other values to...... "Other"
I've seen this code online:
df %>%
mutate(var1 = recode(var1, 'oldvalue1' = 'newvalue1', 'oldvalue2' = 'newvalue2'),
var2 = recode(var2, 'oldvalue1' = 'newvalue1', 'oldvalue2' = 'newvalue2'))
My question: Is there an easier way to do it because as I said there are about 375 values and it takes a lot of time?
Thank you