0
Trim all chrs to the right of a "-" in a column
https://code.sololearn.com/cAPTWR2FzOdP/?ref=app Hi all. I am looking to trim off the hyphen (-) and anything to the right of the hyphen for each value in the "sample ID" column. So for example I would want to transform "D1-2" into "D1". Any value without a hyphen I would want to leave untouched. Very simple code is included in the link above. Apologies for this potentially being a silly question. If I misused any nomenclature I do apologise, I'm very much an R novice and also haven't been involved with the sololearn community in quite a while.
2 ответов
+ 3
I briefly commented the approach in the script:
https://code.sololearn.com/ccu7mo85vMAk/?ref=app
+ 1
This does exactly what I need. Thanks Lisa