I have a tibble with a variable df$sec which is a vector of two character strings.
sec <- c("21", "33", "24", "7-", "32", "1-")  
The character set 7- and 1- should be 07 and 01.
Using {stringr}
df %>% 
  mutate(section = str_replace(string=sec, pattern = ".-$", "0?")) %>% 
  select(section)  
This returns:   21,33,24,0?, 32, 0?
How do I return the characters 7- and 1- as 07 and 01?
 
     
    