Suppose I have an "option code" column in my tbl, the data is like this:
m1803-C-2550
m1807-P-3050
I want to grab C/P between "-" as my new variable "option type", and 2550/3050 after the second "-" as my new variable "strike price".
How do I code with tidyverse?
Now, I could solve the first question by
tbl %>% mutate(option_type = str_sub(option_code, str_locate(option_code, "[CP]"))
But I could not solve my second question, or you guys may have an elegant way to solve my first question.