Hi,
I would appreciate help with constructing regex pattern. I have a character vector such as
vector <- c("r01052",
"r0105a2",
"r01052a",
"r0105a2a")
I would like to create two columns. First, with first 5 characters and if there is a letter after the fifth character => with first 6 characters. Hence, in this case, I would get:
first_column <- c("r0105",
"r0105a",
"r0105",
"r0105a")
Second, with last character and if there is a letter as a last character => with two last characters. Again, in this case, I would get:
second_column <- c("2",
"2",
"2a",
"2a")
Could you help me with constructing regex patterns for str_substract? Note that the provided vector is just an example and individual letters and individual numbers change, the only thing which is constant is the pattern of letters and numbers.
Many thinks,
Jakub