I have the dataframe below:
library(stringr)
library(dbplyr)
df1 <- data.frame(A = c("4 M", "56 M", "89 M", "25 M", "50 M", "NA M"), B = letters[1:6])
I want to replace the "NA M term
df2 <- df1 %>% mutate(A = str_replace(A, "NA M", "TBD"))
this works just fine, but if I add the $ sign
df1 <- data.frame(A = c("$4 M", "$56 M", "$89 M", "$25 M", "$50 M", "$NA M"), B = letters[1:6])
df2 <- df1 %>% mutate(A = str_replace(A, "$NA M", "TBD"))
Then nothing happens. How can I account for special characters when using str_replace