Hi!
I have a string, that follows a predictable format, and I'm looking to replace certain characters in it. Please see below. Any help is appreciated.
What I need to do is remove the initial underscore in each space delimited chunk, while keeping any underscores in the string. E.g.
I have a list of 4-5 patterns that I've solved using {stringr} and / or gsub() and this is the only one I can't get. I realized I could break the string up into space delimited bits and use substr to cleave off the first character, but I'm wondering if there is a more elegant way?
Any help is appreciated!
I have a string, that follows a predictable format, and I'm looking to replace certain characters in it. Please see below. Any help is appreciated.
Code:
> have <- "_a _a_1 _a_2 _a_3"
> have
[1] "_a _a_1 _a_2 _a_3"
Code:
> want <- "a a_1 a_2 a_3"
> want
[1] "a a_1 a_2 a_3"
Any help is appreciated!