I have data in the following format:
2213000
6314931
2224100+ 2224200+ 2224900
I would like to remove everything after the first "+" sign for those characters in which "+" appears, while retaining the part of the character before the sign.
In other words, from the example above, I would need to have the following:
2213000
6314931
2224100
I have tried the following code,
my_data <- (gsub("\\+.*", "", mydata))
which returns a blank string, whereas I would need to retain the character before the first "+" sign.
Would greatly appreciate any help on how to fix this!