I hope this is the right place to ask my question: I want to replace longer male/female strings in the sex-column of my data.frame with just 'm'/'f'. How to build a wildcard-function stating "if string starts with m/f, set its values to m/f"?
Possible data:
df <- data.frame(list(A=c("fem","mal"), B=c(12, 17)))
Thank you so much