I have a column in R which looks like below:
won <- c("\001", rep("\\0",3), "\001")
won
\001
\\0
\\0
\\0
\\0
\001
There are two possible values, \0 or \001
I am wondering what the most efficient route is to change these values to
0 (for \0) and 1 (for \001). I’m sure gsub() is one option, it’s jut not clear if
it’s the way to go to alter two separate string values.
For this specific case:
Here is another option: